예제 #1
0
<?php

/**
 * 自动引入每个模型的挂件文件
 * tangbing <*****@*****.**>
 * 2015/10/14 16:20
 */
if (getModuleInfo()) {
    $widgets_dir = getModuleInfo()->getPath() . '/Widgets';
    if (is_dir($widgets_dir)) {
        $dir = dir($widgets_dir);
        while ($file = $dir->read()) {
            if (in_array($file, ['.', '..']) || substr($file, '-3', '3') != 'php' || !is_file($widgets_dir . '/' . $file)) {
                continue;
            }
            include $widgets_dir . '/' . $file;
        }
    }
}
/*
 * DEMO 部分 
 * 文档地址:http://sky.pingpong-labs.com/docs/2.0/widget
 */
Widget::register('demo', function ($contents) {
    return "<h1>{$contents}</h1>";
});
예제 #2
0
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();
    }
    if (!$isSessionVariableTableExists && $objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.2.0')) {
        if (!migrateSessionTable()) {
            setUpdateMsg('Error in updating session table', 'error');
            return false;
        }
        setUpdateMsg(1, 'timeout');
        return false;
    }
    // Load Doctrine (this must be done after the UTF-8 Migration, because we'll need $_DBCONFIG['charset'] to be set)
    $incDoctrineStatus = (require_once UPDATE_PATH . '/config/doctrine.php');
    Env::set('incDoctrineStatus', $incDoctrineStatus);
    $userData = array('id' => $_SESSION['contrexx_update']['user_id'], 'name' => $_SESSION['contrexx_update']['username']);
    $loggableListener = \Env::get('loggableListener');
    $loggableListener->setUsername(json_encode($userData));
    /////////////////////
    if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.0.0')) {
        //////////////////////////////
        // BEGIN: CONTENT MIGRATION //
        //////////////////////////////
        DBG::msg('Installed version: ' . $_CONFIG['coreCmsVersion']);
        Env::get('ClassLoader')->loadFile(dirname(__FILE__) . '/ContentMigration.class.php');
        $contentMigration = new \Cx\Update\Cx_3_0_4\ContentMigration();
        // Migrate statistics - this must be done before migrating to the new content architecture
        if (empty($_SESSION['contrexx_update']['content_stats'])) {
            DBG::msg('Migrate stats');
            if ($contentMigration->migrateStatistics()) {
                $_SESSION['contrexx_update']['content_stats'] = true;
                if (!checkMemoryLimit() || !checkTimeoutLimit()) {
                    return false;
                }
            } else {
                return false;
            }
        }
        // Check if there are content of inactive languages.
        // If true then ask if the update system can remove them.
        if (empty($_SESSION['contrexx_update']['inactive_content_languages_checked'])) {
            DBG::msg('Check inactive content languages');
            $arrMigrateLangIds = $contentMigration->getActiveContentLanguageIds();
            if (!isset($_POST['skipMigrateLangIds'])) {
                $result = $contentMigration->getInactiveContentLanguageCheckboxes();
                if (!empty($result)) {
                    setUpdateMsg('Inhaltsseiten von inaktiven Sprache(n) gefunden', 'title');
                    setUpdateMsg('
                        Folgende Sprache(n) sind inaktiv, aber enthalten Inhaltsseiten:<br />
                        ' . $result . '<br />
                        Wählen Sie die inaktiven Sprachen, dessen Inhaltseiten Sie migrieren möchten.<br />
                        Klicken Sie anschliessend auf <b>Update fortsetzen...</b>.<br /><br />
                        <div class="message-alert">
                        <b>Achtung:</b><br />
                        Die Inhaltsseiten der inaktive Sprache(n), welche Sie nicht ausgewählt haben, werden gelöscht.
                        </div>
                    ', 'msg');
                    setUpdateMsg('<input type="submit" value="' . $_CORELANG['TXT_CONTINUE_UPDATE'] . '" name="updateNext" /><input type="hidden" name="processUpdate" id="processUpdate" /><input type="hidden" name="skipMigrateLangIds" id="skipMigrateLangIds" />', 'button');
                    return false;
                }
            } else {
                if (!empty($_POST['migrateLangIds'])) {
                    if (is_array($_POST['migrateLangIds'])) {
                        $_POST['migrateLangIds'] = array_filter($_POST['migrateLangIds'], 'intval');
                        if (!empty($_POST['migrateLangIds'])) {
                            $arrMigrateLangIds = array_merge($arrMigrateLangIds, $_POST['migrateLangIds']);
                        }
                    } else {
                        if (intval($_POST['migrateLangIds'])) {
                            $arrMigrateLangIds[] = intval($_POST['migrateLangIds']);
                        }
                    }
                }
            }
            $_SESSION['contrexx_update']['migrate_lang_ids'] = $arrMigrateLangIds;
            $_SESSION['contrexx_update']['inactive_content_languages_checked'] = true;
        }
        if (empty($_SESSION['contrexx_update']['migrate_lang_ids'])) {
            $_SESSION['contrexx_update']['migrate_lang_ids'] = $contentMigration->getActiveContentLanguageIds();
        }
        $contentMigration->arrMigrateLangIds = ContrexxUpdate::_getSessionArray($_SESSION['contrexx_update']['migrate_lang_ids']);
        $contentMigration->migrateLangIds = implode(',', ContrexxUpdate::_getSessionArray($_SESSION['contrexx_update']['migrate_lang_ids']));
        // Migrate content
        if (empty($_SESSION['contrexx_update']['content_migrated'])) {
            DBG::msg('Migrate content');
            $status = $contentMigration->migrate();
            if ($status === true) {
                $_SESSION['contrexx_update']['content_migrated'] = true;
                // log migrated nodes
                DBG::msg('NODES: catId -> nodeId');
                DBG::dump(ContrexxUpdate::_getSessionArray($_SESSION['contrexx_update']['nodes']));
                unset($_SESSION['contrexx_update']['nodes']);
                // log migrated pages
                DBG::msg('PAGES: catId -> pageId');
                DBG::dump(ContrexxUpdate::_getSessionArray($_SESSION['contrexx_update']['pages']));
                unset($_SESSION['contrexx_update']['pages']);
                if (!checkMemoryLimit() || !checkTimeoutLimit()) {
                    return false;
                }
            } else {
                if ($status === 'timeout') {
                    setUpdateMsg(1, 'timeout');
                    return false;
                } else {
                    return false;
                }
            }
        }
        // Page grouping
        if (empty($_SESSION['contrexx_update']['pages_grouped'])) {
            DBG::msg('Group pages');
            $pageGrouping = $contentMigration->pageGrouping();
            if ($pageGrouping === true) {
                $_SESSION['contrexx_update']['pages_grouped'] = true;
                if (!checkMemoryLimit() || !checkTimeoutLimit()) {
                    return false;
                }
            } else {
                if ($pageGrouping === 'timeout') {
                    setUpdateMsg(1, 'timeout');
                    return false;
                } else {
                    if ($pageGrouping === false) {
                        return false;
                    } else {
                        if (!empty($pageGrouping)) {
                            $arrDialogData = array('similarPages' => $contentMigration->similarPages);
                            setUpdateMsg('Inhaltsseiten gruppieren', 'title');
                            setUpdateMsg($pageGrouping, 'msg');
                            setUpdateMsg('<input type="submit" value="' . $_CORELANG['TXT_UPDATE_NEXT'] . '" name="updateNext" /><input type="hidden" name="processUpdate" id="processUpdate" />', 'button');
                            setUpdateMsg($arrDialogData, 'dialog');
                            return false;
                        }
                    }
                }
            }
        }
        // Migrate aliases
        if (empty($_SESSION['contrexx_update']['aliases_migrated'])) {
            DBG::msg('Migrate aliases');
            if ($contentMigration->migrateAliases()) {
                $_SESSION['contrexx_update']['aliases_migrated'] = true;
                if (!checkMemoryLimit() || !checkTimeoutLimit()) {
                    return false;
                }
            } else {
                return false;
            }
        }
        // Migrate blocks
        if (empty($_SESSION['contrexx_update']['blocks_migrated'])) {
            DBG::msg('Migrate blocks');
            if ($contentMigration->migrateBlocks()) {
                $_SESSION['contrexx_update']['blocks_migrated'] = true;
                if (!checkMemoryLimit() || !checkTimeoutLimit()) {
                    return false;
                }
            } else {
                return false;
            }
        }
        // Drop old tables
        if (empty($_SESSION['contrexx_update']['old_tables_dropped'])) {
            DBG::msg('Drop old tables');
            if ($contentMigration->dropOldTables()) {
                $_SESSION['contrexx_update']['old_tables_dropped'] = true;
                if (!checkMemoryLimit() || !checkTimeoutLimit()) {
                    return false;
                }
            }
        }
        ////////////////////////////
        // END: CONTENT MIGRATION //
        ////////////////////////////
    } else {
        ///////////////////////////////////////////
        // BEGIN: UPDATE FOR CONTREXX 3 OR NEWER //
        ///////////////////////////////////////////
        $result = _updateModuleRepository();
        if ($result === false) {
            DBG::msg('unable to update module repository');
            if (empty($objUpdate->arrStatusMsg['title'])) {
                setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_COMPONENT_BUG'], $_CORELANG['TXT_UPDATE_MODULE_REPOSITORY']), 'title');
            }
            return false;
        } else {
            try {
                \Cx\Lib\UpdateUtil::sql('UPDATE `' . DBPREFIX . 'log_entry`
                    SET `object_class` = \'Cx\\\\Core\\\\ContentManager\\\\Model\\\\Entity\\\\Page\'
                    WHERE object_class = \'Cx\\\\Model\\\\ContentManager\\\\Page\'');
            } catch (\Cx\Lib\UpdateException $e) {
                return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
            }
            // before an update of module page can be done, the db changes have to be done
            \Cx\Lib\UpdateUtil::table(DBPREFIX . 'content_page', array('id' => array('type' => 'INT(11)', 'notnull' => true, 'auto_increment' => true, 'primary' => true), 'node_id' => array('type' => 'INT(11)', 'notnull' => false, 'after' => 'id'), 'nodeIdShadowed' => array('type' => 'INT(11)', 'notnull' => false, 'after' => 'node_id'), 'lang' => array('type' => 'INT(11)', 'after' => 'nodeIdShadowed'), 'type' => array('type' => 'VARCHAR(16)', 'after' => 'lang'), 'caching' => array('type' => 'TINYINT(1)', 'after' => 'type'), 'updatedAt' => array('type' => 'timestamp', 'after' => 'caching', 'notnull' => false), 'updatedBy' => array('type' => 'CHAR(40)', 'after' => 'updatedAt'), 'title' => array('type' => 'VARCHAR(255)', 'after' => 'updatedBy'), 'linkTarget' => array('type' => 'VARCHAR(16)', 'notnull' => false, 'after' => 'title'), 'contentTitle' => array('type' => 'VARCHAR(255)', 'after' => 'linkTarget'), 'slug' => array('type' => 'VARCHAR(255)', 'after' => 'contentTitle'), 'content' => array('type' => 'longtext', 'after' => 'slug'), 'sourceMode' => array('type' => 'TINYINT(1)', 'notnull' => true, 'default' => '0', 'after' => 'content'), 'customContent' => array('type' => 'VARCHAR(64)', 'notnull' => false, 'after' => 'sourceMode'), 'useCustomContentForAllChannels' => array('type' => 'INT(2)', 'after' => 'customContent', 'notnull' => false), 'cssName' => array('type' => 'VARCHAR(255)', 'notnull' => false, 'after' => 'useCustomContentForAllChannels'), 'cssNavName' => array('type' => 'VARCHAR(255)', 'notnull' => false, 'after' => 'cssName'), 'skin' => array('type' => 'INT(11)', 'notnull' => false, 'after' => 'cssNavName'), 'useSkinForAllChannels' => array('type' => 'INT(2)', 'after' => 'skin', 'notnull' => false), 'metatitle' => array('type' => 'VARCHAR(255)', 'notnull' => false, 'after' => 'useSkinForAllChannels'), 'metadesc' => array('type' => 'text', 'after' => 'metatitle'), 'metakeys' => array('type' => 'text', 'after' => 'metadesc'), 'metarobots' => array('type' => 'VARCHAR(7)', 'notnull' => false, 'after' => 'metakeys'), 'start' => array('type' => 'timestamp', 'after' => 'metarobots', 'notnull' => false), 'end' => array('type' => 'timestamp', 'after' => 'start', 'notnull' => false), 'editingStatus' => array('type' => 'VARCHAR(16)', 'after' => 'end'), 'protection' => array('type' => 'INT(11)', 'after' => 'editingStatus'), 'frontendAccessId' => array('type' => 'INT(11)', 'after' => 'protection'), 'backendAccessId' => array('type' => 'INT(11)', 'after' => 'frontendAccessId'), 'display' => array('type' => 'TINYINT(1)', 'after' => 'backendAccessId'), 'active' => array('type' => 'TINYINT(1)', 'after' => 'display'), 'target' => array('type' => 'VARCHAR(255)', 'notnull' => false, 'after' => 'active'), 'module' => array('type' => 'VARCHAR(255)', 'notnull' => false, 'after' => 'target'), 'cmd' => array('type' => 'VARCHAR(50)', 'notnull' => true, 'default' => '', 'after' => 'module')), array('node_id' => array('fields' => array('node_id', 'lang'), 'type' => 'UNIQUE'), 'IDX_D8E86F54460D9FD7' => array('fields' => array('node_id'))), 'InnoDB', '', array('node_id' => array('table' => DBPREFIX . 'content_node', 'column' => 'id', 'onDelete' => 'SET NULL', 'onUpdate' => 'NO ACTION')));
            if (_convertThemes2Component() === false) {
                if (empty($objUpdate->arrStatusMsg['title'])) {
                    DBG::msg('unable to convert themes to component');
                    setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_COMPONENT_BUG'], $_CORELANG['TXT_UPDATE_CONVERT_TEMPLATES']), 'title');
                }
                return false;
            }
            if (_updateModulePages($viewUpdateTable) === false) {
                if (empty($objUpdate->arrStatusMsg['title'])) {
                    DBG::msg('unable to update module templates');
                    setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_COMPONENT_BUG'], $_CORELANG['TXT_UPDATE_MODULE_TEMPLATES']), 'title');
                }
                return false;
            }
            /* else {
                   if (!in_array('moduleStyles', $_SESSION['contrexx_update']['update']['done'])) {
                       if (_updateCssDefinitions($viewUpdateTable, $objUpdate) === false) {
                           if (empty($objUpdate->arrStatusMsg['title'])) {
                               setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_COMPONENT_BUG'], $_CORELANG['TXT_UPDATE_MODULE_TEMPLATES']), 'title');
                           }
                           return false;
                       }
                       $_SESSION['contrexx_update']['update']['done'][] = 'moduleStyles';
                   }
               }*/
        }
        // we are updating from 3.0.0 rc1, rc2, stable or 3.0.0.1
        if (!(include_once dirname(__FILE__) . '/update3.php')) {
            setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_UNABLE_LOAD_UPDATE_COMPONENT'], dirname(__FILE__) . '/update3.php'));
            return false;
        }
        if (!createHtAccess()) {
            $webServerSoftware = !empty($_SERVER['SERVER_SOFTWARE']) && stristr($_SERVER['SERVER_SOFTWARE'], 'apache') ? 'apache' : (stristr($_SERVER['SERVER_SOFTWARE'], 'iis') ? 'iis' : '');
            $file = $webServerSoftware == 'iis' ? 'web.config' : '.htaccess';
            setUpdateMsg('Die Datei \'' . $file . '\' konnte nicht erstellt/aktualisiert werden.');
            return false;
        }
        // Update configuration.php
        if (!_writeNewConfigurationFile()) {
            return false;
        }
        $arrUpdate = $objUpdate->getLoadedVersionInfo();
        $_CONFIG['coreCmsVersion'] = $arrUpdate['cmsVersion'];
        $lupd = new License();
        try {
            $lupd->update(false);
        } catch (\Cx\Lib\UpdateException $e) {
            setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_COMPONENT_BUG'], $_CORELANG['TXT_UPDATE_LICENSE_DATA']), 'title');
            return false;
        }
        return true;
        /////////////////////////////////////////
        // END: UPDATE FOR CONTREXX 3 OR NEWER //
        /////////////////////////////////////////
    }
    ///////////////////////////////////////////
    // CONTINUE UPDATE FOR NON CX 3 VERSIONS //
    ///////////////////////////////////////////
    $arrDirs = array('core_module', 'module');
    $updateStatus = true;
    if (!(include_once dirname(__FILE__) . '/components/core/backendAreas.php')) {
        setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_UNABLE_LOAD_UPDATE_COMPONENT'], dirname(__FILE__) . '/components/core/backendAreas.php'));
        return false;
    } elseif (!(include_once dirname(__FILE__) . '/components/core/modules.php')) {
        setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_UNABLE_LOAD_UPDATE_COMPONENT'], dirname(__FILE__) . '/components/core/modules.php'));
        return false;
    } elseif (!(include_once dirname(__FILE__) . '/components/core/settings.php')) {
        setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_UNABLE_LOAD_UPDATE_COMPONENT'], dirname(__FILE__) . '/components/core/settings.php'));
        return false;
    }
    if (!in_array('coreUpdate', ContrexxUpdate::_getSessionArray($_SESSION['contrexx_update']['update']['done']))) {
        $result = _coreUpdate();
        if ($result === false) {
            if (empty($objUpdate->arrStatusMsg['title'])) {
                setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_COMPONENT_BUG'], $_CORELANG['TXT_UPDATE_CORE_SYSTEM']), 'title');
            }
            return false;
        } else {
            $_SESSION['contrexx_update']['update']['done'][] = 'coreUpdate';
        }
    }
    $missedModules = array();
    if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.0.0')) {
        $missedModules = getMissedModules();
        $conflictedModules = getConflictedModules($missedModules);
        if (!empty($conflictedModules)) {
            $conflictedModulesList = '';
            foreach ($conflictedModules as $moduleName => $moduleTables) {
                $conflictedModulesList = '<li><strong>' . $moduleName . ':</strong> ' . implode(', ', $moduleTables) . '</li>';
            }
            setUpdateMsg($_CORELANG['TXT_CONFLICTED_MODULES_TITLE'], 'title');
            setUpdateMsg($_CORELANG['TXT_CONFLICTED_MODULES_DESCRIPTION'] . '<ul>' . $conflictedModulesList . '</ul>', 'msg');
            setUpdateMsg('<input type="submit" value="' . $_CORELANG['TXT_UPDATE_TRY_AGAIN'] . '" name="updateNext" /><input type="hidden" name="processUpdate" id="processUpdate" />', 'button');
            return false;
        }
    }
    foreach ($arrDirs as $dir) {
        $dh = opendir(dirname(__FILE__) . '/components/' . $dir);
        if ($dh) {
            while (($file = readdir($dh)) !== false) {
                if (!in_array($file, ContrexxUpdate::_getSessionArray($_SESSION['contrexx_update']['update']['done']))) {
                    $fileInfo = pathinfo(dirname(__FILE__) . '/components/' . $dir . '/' . $file);
                    if ($fileInfo['extension'] == 'php') {
                        DBG::msg("--------- updating {$file} ------");
                        if (!(include_once dirname(__FILE__) . '/components/' . $dir . '/' . $file)) {
                            setUpdateMsg($_CORELANG['TXT_UPDATE_ERROR'], 'title');
                            setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_UNABLE_LOAD_UPDATE_COMPONENT'], dirname(__FILE__) . '/components/' . $dir . '/' . $file));
                            return false;
                        }
                        if (!in_array($fileInfo['filename'], $missedModules)) {
                            $function = '_' . $fileInfo['filename'] . 'Update';
                            if (function_exists($function)) {
                                $result = $function();
                                if ($result === false) {
                                    if (empty($objUpdate->arrStatusMsg['title'])) {
                                        setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_COMPONENT_BUG'], $file), 'title');
                                    }
                                    return false;
                                } elseif ($result === 'timeout') {
                                    setUpdateMsg(1, 'timeout');
                                    return false;
                                }
                            } else {
                                setUpdateMsg($_CORELANG['TXT_UPDATE_ERROR'], 'title');
                                setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_UPDATE_COMPONENT_CORRUPT'], '.' . $fileInfo['filename'], $file));
                                return false;
                            }
                        } else {
                            $function = '_' . $fileInfo['filename'] . 'Install';
                            if (function_exists($function)) {
                                $result = $function();
                                if ($result === false) {
                                    if (empty($objUpdate->arrStatusMsg['title'])) {
                                        setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_COMPONENT_BUG'], $file), 'title');
                                    }
                                    return false;
                                } elseif ($result === 'timeout') {
                                    setUpdateMsg(1, 'timeout');
                                    return false;
                                } else {
                                    // fetch module info from components/core/module.php
                                    $arrModule = getModuleInfo($fileInfo['filename']);
                                    if ($arrModule) {
                                        try {
                                            \Cx\Lib\UpdateUtil::sql("INSERT INTO " . DBPREFIX . "modules ( `id` , `name` , `description_variable` , `status` , `is_required` , `is_core` , `distributor` ) VALUES ( " . $arrModule['id'] . " , '" . $arrModule['name'] . "', '" . $arrModule['description_variable'] . "', '" . $arrModule['status'] . "', '" . $arrModule['is_required'] . "', '" . $arrModule['is_core'] . "', 'Comvation AG') ON DUPLICATE KEY UPDATE `id` = `id`");
                                        } catch (\Cx\Lib\UpdateException $e) {
                                            return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
                                        }
                                    } else {
                                        DBG::msg('unable to register module ' . $fileInfo['filename']);
                                    }
                                }
                            } else {
                                setUpdateMsg($_CORELANG['TXT_UPDATE_ERROR'], 'title');
                                setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_UPDATE_COMPONENT_CORRUPT'], '.' . $fileInfo['filename'], $file));
                                return false;
                            }
                        }
                    }
                    $_SESSION['contrexx_update']['update']['done'][] = $file;
                    setUpdateMsg(1, 'timeout');
                    return false;
                }
            }
        } else {
            setUpdateMsg($_CORELANG['TXT_UPDATE_ERROR'], 'title');
            setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_UNABLE_LOAD_DIR_COMPONENTS'], dirname(__FILE__) . '/components/' . $dir));
            return false;
        }
        closedir($dh);
    }
    if (!in_array('coreSettings', ContrexxUpdate::_getSessionArray($_SESSION['contrexx_update']['update']['done']))) {
        $result = _updateSettings();
        if ($result === false) {
            if (empty($objUpdate->arrStatusMsg['title'])) {
                setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_COMPONENT_BUG'], $_CORELANG['TXT_UPDATE_BASIC_CONFIGURATION']), 'title');
            }
            return false;
        } else {
            // update configuration.php (migrate to new format)
            if (!_writeNewConfigurationFile()) {
                return false;
            }
            $_SESSION['contrexx_update']['update']['done'][] = 'coreSettings';
            // till this point the file config/version.php was still loaded upon a request,
            // therefore we must force a new page request here, to ensure that the file config/version.php
            // will not be loaded anylonger. This is essential here, otherwise the old values of config/version.php
            // would screw up the update process
            setUpdateMsg(1, 'timeout');
            return false;
        }
    }
    if (!in_array('coreModules', ContrexxUpdate::_getSessionArray($_SESSION['contrexx_update']['update']['done']))) {
        $result = _updateModules();
        if ($result === false) {
            if (empty($objUpdate->arrStatusMsg['title'])) {
                setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_COMPONENT_BUG'], $_CORELANG['TXT_UPDATE_MODULES']), 'title');
            }
            return false;
        } else {
            $_SESSION['contrexx_update']['update']['done'][] = 'coreModules';
        }
    }
    if (!in_array('coreBackendAreas', ContrexxUpdate::_getSessionArray($_SESSION['contrexx_update']['update']['done']))) {
        $result = _updateBackendAreas();
        if ($result === false) {
            if (empty($objUpdate->arrStatusMsg['title'])) {
                setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_COMPONENT_BUG'], $_CORELANG['TXT_UPDATE_SECURITY_SYSTEM']), 'title');
            }
            return false;
        } else {
            $_SESSION['contrexx_update']['update']['done'][] = 'coreBackendAreas';
        }
    }
    if (!in_array('coreModuleRepository', ContrexxUpdate::_getSessionArray($_SESSION['contrexx_update']['update']['done']))) {
        $result = _updateModuleRepository();
        if ($result === false) {
            DBG::msg('unable to update module repository');
            if (empty($objUpdate->arrStatusMsg['title'])) {
                setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_COMPONENT_BUG'], $_CORELANG['TXT_UPDATE_MODULE_REPOSITORY']), 'title');
            }
            return false;
        } else {
            $_SESSION['contrexx_update']['update']['done'][] = 'coreModuleRepository';
        }
    }
    if (!in_array('convertTemplates', ContrexxUpdate::_getSessionArray($_SESSION['contrexx_update']['update']['done']))) {
        $result = _convertThemes2Component();
        if ($result === false) {
            if (empty($objUpdate->arrStatusMsg['title'])) {
                DBG::msg('unable to convert themes to component');
                setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_COMPONENT_BUG'], $_CORELANG['TXT_UPDATE_CONVERT_TEMPLATES']), 'title');
            }
            return false;
        } else {
            $_SESSION['contrexx_update']['update']['done'][] = 'convertTemplates';
        }
    }
    if (!in_array('moduleTemplates', ContrexxUpdate::_getSessionArray($_SESSION['contrexx_update']['update']['done']))) {
        if (_updateModulePages($viewUpdateTable) === false) {
            if (empty($objUpdate->arrStatusMsg['title'])) {
                DBG::msg('unable to update module templates');
                setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_COMPONENT_BUG'], $_CORELANG['TXT_UPDATE_MODULE_TEMPLATES']), 'title');
            }
            return false;
        } else {
            $_SESSION['contrexx_update']['update']['done'][] = 'moduleTemplates';
        }
    }
    if (!in_array('moduleStyles', ContrexxUpdate::_getSessionArray($_SESSION['contrexx_update']['update']['done']))) {
        if (_updateCssDefinitions($viewUpdateTable, $objUpdate) === false) {
            if (empty($objUpdate->arrStatusMsg['title'])) {
                setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_COMPONENT_BUG'], $_CORELANG['TXT_UPDATE_MODULE_TEMPLATES']), 'title');
            }
            return false;
        } else {
            $_SESSION['contrexx_update']['update']['done'][] = 'moduleStyles';
        }
    }
    if (!in_array('navigations', ContrexxUpdate::_getSessionArray($_SESSION['contrexx_update']['update']['done']))) {
        if (_updateNavigations() === false) {
            if (empty($objUpdate->arrStatusMsg['title'])) {
                setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_COMPONENT_BUG'], $_CORELANG['TXT_UPDATE_NAVIGATIONS']), 'title');
            }
            return false;
        } else {
            $_SESSION['contrexx_update']['update']['done'][] = 'navigations';
        }
    }
    if (!createHtAccess()) {
        $webServerSoftware = !empty($_SERVER['SERVER_SOFTWARE']) && stristr($_SERVER['SERVER_SOFTWARE'], 'apache') ? 'apache' : (stristr($_SERVER['SERVER_SOFTWARE'], 'iis') ? 'iis' : '');
        $file = $webServerSoftware == 'iis' ? 'web.config' : '.htaccess';
        setUpdateMsg('Die Datei \'' . $file . '\' konnte nicht erstellt/aktualisiert werden.');
        return false;
    }
    if (file_exists(ASCMS_DOCUMENT_ROOT . ASCMS_BACKEND_PATH . '/index.php')) {
        \DBG::msg('/cadmin/index.php still exists...');
        // move cadmin index.php if its customized
        if (!loadMd5SumOfOriginalCxFiles()) {
            return false;
        }
        if (!verifyMd5SumOfFile(ASCMS_DOCUMENT_ROOT . ASCMS_BACKEND_PATH . '/index.php', '', false)) {
            \DBG::msg('...and it\'s customized, so let\'s move it to customizing directory');
            // changes, backup modified file
            if (!backupModifiedFile(ASCMS_DOCUMENT_ROOT . ASCMS_BACKEND_PATH . '/index.php')) {
                setUpdateMsg('Die Datei \'' . ASCMS_DOCUMENT_ROOT . ASCMS_BACKEND_PATH . '/index.php\' konnte nicht kopiert werden.');
                return false;
            }
        } else {
            \DBG::msg('...but it\'s not customized');
        }
        // no non-backupped changes, can delete
        try {
            \DBG::msg('So let\'s remove it...');
            $cadminIndex = new \Cx\Lib\FileSystem\File(ASCMS_DOCUMENT_ROOT . ASCMS_BACKEND_PATH . '/index.php');
            $cadminIndex->delete();
        } catch (\Cx\Lib\FileSystem\FileSystemException $e) {
            setUpdateMsg('Die Datei \'' . ASCMS_DOCUMENT_ROOT . ASCMS_BACKEND_PATH . '/index.php\' konnte nicht gelöscht werden.');
            return false;
        }
    }
    $arrUpdate = $objUpdate->getLoadedVersionInfo();
    $_CONFIG['coreCmsVersion'] = $arrUpdate['cmsVersion'];
    if (!in_array('coreLicense', ContrexxUpdate::_getSessionArray($_SESSION['contrexx_update']['update']['done']))) {
        $lupd = new License();
        try {
            $result = $lupd->update();
        } catch (\Cx\Lib\UpdateException $e) {
            setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_COMPONENT_BUG'], $_CORELANG['TXT_UPDATE_LICENSE_DATA']), 'title');
            return false;
        }
        // ignore error to allow offline installations
        /*if ($result === false) {
              if (empty($objUpdate->arrStatusMsg['title'])) {
                  setUpdateMsg(sprintf($_CORELANG['TXT_UPDATE_COMPONENT_BUG'], $_CORELANG['TXT_UPDATE_LICENSE_DATA']), 'title');
              }
              return false;
          } else {*/
        $_SESSION['contrexx_update']['update']['done'][] = 'coreLicense';
        //}
    }
    return true;
}
예제 #3
0
 public function isModulePermitted($module = false)
 {
     if ($module === false && isset($_REQUEST["m"])) {
         $module = $_REQUEST["m"];
     }
     /**
      * if module not set, it is home module. It is allowed
      */
     if ($module === false) {
         return true;
     }
     $data_item_type = 0;
     $actionMapping = array();
     $arrModuleInfo = getModuleInfo("modulename");
     if (isset($arrModuleInfo[$module])) {
         if ($module == "joborders") {
             $reqModuleInfo = $arrModuleInfo["joborders"];
             $libModuleName = "JobOrders";
             include_once "lib/{$libModuleName}.php";
             $data_item_type = $reqModuleInfo["data_item_type_id"];
             $actionMapping = $libModuleName::actionMapping();
         } else {
             $reqModuleInfo = $arrModuleInfo[$module];
             $libModuleName = ucfirst($module);
             include_once "lib/{$libModuleName}.php";
             $data_item_type = $reqModuleInfo["data_item_type_id"];
             $actionMapping = $libModuleName::actionMapping();
         }
     }
     /*switch ($module)
       {
           case 'candidates':
           {
               include_once("lib/Candidates.php");
               $data_item_type=100;
               $actionMapping=  Candidates::actionMapping();
               break;
           }
           case 'companies':
           {
               include_once("lib/Companies.php");
               $data_item_type=200;
               $actionMapping= Companies::actionMapping();
               break;
           }
           case 'contacts':
           {
               include_once("lib/Contacts.php");
               $data_item_type=300;
               $actionMapping= Contacts::actionMapping();
               break;
           }
           case 'joborders':
           {
               include_once("lib/JobOrders.php");
               $data_item_type=400;
               $actionMapping= JobOrders::actionMapping();
               break;
           }
       }*/
     /**
      * if $data_item_type is 0, it indicates other modules. so it is allowed
      */
     if ($data_item_type <= 0) {
         return true;
     }
     //insert into auieo_profiles2permissions (`profileid`,`data_item_type`,`operation`,`permissions`,`site_id`) values ('3','400','4','0','180');
     /*$permissions = array(
           "listByView"=>4,
           "add"=>0,
           "edit"=>1,
           "show"=>2,
           "delete"=>3,
           "default"=>"listByView"
       );*/
     if (!isset($this->permission[$data_item_type])) {
         return false;
     }
     $modulePermission = $this->permission[$data_item_type];
     /**
      * checks whether any one operation is allowed
      */
     $isModulePermited = false;
     if ($modulePermission) {
         foreach ($modulePermission as $operation => $permission) {
             if ($permission > 0) {
                 return true;
             }
         }
     }
     /**
      * since all the operation is not allowed, don't allow
      */
     return false;
 }
예제 #4
0
<h2><?php 
echo _T("Module Info");
?>
</h2>
<div class="phpinfo"><?php 
echo getModuleInfo();
?>
</div>
예제 #5
0
파일: update3.php 프로젝트: Niggu/cloudrexx
            return false;
        }
    }
}
if ($objUpdate->_isNewerVersion($_CONFIG['coreCmsVersion'], '3.1.0')) {
    // install crm
    require_once dirname(__FILE__) . '/components/core/modules.php';
    $crmModuleInfo = getModuleInfo('crm');
    try {
        \Cx\Lib\UpdateUtil::sql("INSERT IGNORE INTO " . DBPREFIX . "modules ( `id` , `name` , `description_variable` , `status` , `is_required` , `is_core` , `distributor` ) VALUES ( " . $crmModuleInfo['id'] . " , '" . $crmModuleInfo['name'] . "', '" . $crmModuleInfo['description_variable'] . "', '" . $crmModuleInfo['status'] . "', '" . $crmModuleInfo['is_required'] . "', '" . $crmModuleInfo['is_core'] . "', 'Comvation AG') ON DUPLICATE KEY UPDATE `id` = `id`");
    } catch (\Cx\Lib\UpdateException $e) {
        return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
    }
    \DBG::log('installing crm module');
    // install frontend editing
    $frontendEditingModuleInfo = getModuleInfo('FrontendEditing');
    try {
        \Cx\Lib\UpdateUtil::sql("INSERT IGNORE INTO " . DBPREFIX . "modules ( `id` , `name` , `description_variable` , `status` , `is_required` , `is_core` , `distributor` ) VALUES ( " . $frontendEditingModuleInfo['id'] . " , '" . $frontendEditingModuleInfo['name'] . "', '" . $frontendEditingModuleInfo['description_variable'] . "', '" . $frontendEditingModuleInfo['status'] . "', '" . $frontendEditingModuleInfo['is_required'] . "', '" . $frontendEditingModuleInfo['is_core'] . "', 'Comvation AG') ON DUPLICATE KEY UPDATE `id` = `id`");
    } catch (\Cx\Lib\UpdateException $e) {
        return \Cx\Lib\UpdateUtil::DefaultActionHandler($e);
    }
}
// Add primary keys
$result = \Cx\Lib\UpdateUtil::sql('SHOW KEYS FROM `' . DBPREFIX . 'access_group_dynamic_ids`');
if ($result->EOF) {
    \Cx\Lib\UpdateUtil::sql('ALTER IGNORE TABLE `' . DBPREFIX . 'access_group_dynamic_ids` ADD PRIMARY KEY ( `access_id` , `group_id` )');
}
$result = \Cx\Lib\UpdateUtil::sql('SHOW KEYS FROM `' . DBPREFIX . 'access_group_static_ids`');
if ($result->EOF) {
    \Cx\Lib\UpdateUtil::sql('ALTER IGNORE TABLE `' . DBPREFIX . 'access_group_static_ids` ADD PRIMARY KEY ( `access_id` , `group_id` )');
}
예제 #6
0
/**
 * add the where condition for listing the record
 * @param type $dgModule
 * @return string
 */
function getPermittedRecordWhere($dgModule)
{
    $arrModuleInfo = getModuleInfo("modulename");
    if (!isset($arrModuleInfo[$dgModule])) {
        return array();
    }
    $moduleInfo = $arrModuleInfo[$dgModule];
    $dgTable = $moduleInfo["tablename"];
    $whereSQL = array();
    $access_level = Users::getInstance()->getUserInfo("access_level");
    if ($access_level == 500) {
        return $whereSQL;
    }
    if ($dgTable) {
        $data_item_type = $moduleInfo["data_item_type_id"];
        if (getSharingAccess($data_item_type) <= 0) {
            $obj = Users::getInstance();
            $arrTmpWhere = array();
            $arrTmpWhere[] = "({$dgTable}.owner = " . $_SESSION["CATS"]->getUserID() . " and {$dgTable}.ownertype=0)";
            $arrUserAllowed = $obj->getChildRolesUsers();
            if ($arrUserAllowed) {
                foreach ($arrUserAllowed as $userAllowed) {
                    $arrTmpWhere[] = "({$dgTable}.owner = {$userAllowed} and {$dgTable}.ownertype=0)";
                }
            }
            $arrGroup = $obj->getAllGroups();
            if ($arrGroup) {
                foreach ($arrGroup as $group) {
                    $arrTmpWhere[] = "({$dgTable}.owner = {$group} and {$dgTable}.ownertype=1)";
                }
            }
            $whereSQL[] = "(" . implode(" OR ", $arrTmpWhere) . ")";
        }
    }
    return $whereSQL;
}
예제 #7
0
        <br>
        <div class="well">
            <h1><font size="5">Modules teaching</font></h1>
            <div class="table-responsive">
                <table class="table table-striped">
                    <thead>
                    <tr>
                        <th>Module code</th>
                        <th>Module title</th>
                        <th>Credits</th>
                        <th>Class id</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php 
if (isset($_POST['search'])) {
    $id = $_POST['id'];
    getModuleInfo($id, $conn);
}
?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>



</div>
</body>
</html>
예제 #8
0
    public function profiles()
    {
        if(isset($_REQUEST["s"]))
        {
            $objDB=DatabaseConnection::getInstance();
            $site_id=$_SESSION["CATS"]->getSiteID();
            switch($_REQUEST["s"])
            {
                case 'update_cell':
                {
                    $sql="update auieo_profiles set profilename='{$_REQUEST["cell_data"]}' where id='{$_REQUEST["recordid"]}' and site_id={$site_id}";
                    $objDB->query($sql);
                    break;
                }
                case 'delete':
                {
                    $sql="delete from auieo_profiles where id={$_REQUEST["profileid"]}";
                    $objDB->query($sql);
                    header("Location:index.php?m=settings&a=profiles");exit;
                    break;
                }
                case 'update_permission':
                {
                    $data_item_type=0;
                    $arrModuleInfo=getModuleInfo("modulename");
                    foreach($arrModuleInfo as $modulename=>$moduleInfo)
                    {
                        if($_REQUEST["module"] == $modulename)
                        {
                            $data_item_type=$moduleInfo["data_item_type_id"];
                            break;
                        }
                    }
                    $sql="select * from auieo_profiles2permissions where  data_item_type='{$data_item_type}' and profileid={$_REQUEST["profileid"]} and operation={$_REQUEST["fieldname"]} and site_id={$site_id}";
                    if($objDB->getAssoc($sql))
                    {
                        $sql="update auieo_profiles2permissions set permissions={$_REQUEST["cell_data"]}  where data_item_type='{$data_item_type}' and profileid={$_REQUEST["profileid"]} and operation={$_REQUEST["fieldname"]} and site_id={$site_id}";
                        $objDB->query($sql);
                    }
                    else
                    {
                        $sql="insert into auieo_profiles2permissions (permissions,data_item_type,profileid,operation,site_id) values({$_REQUEST["cell_data"]},'{$data_item_type}',{$_REQUEST["profileid"]},'{$_REQUEST["fieldname"]}',{$site_id})";
                        $objDB->query($sql);
                    }
                    break;
                }
                case 'load_profile':
                {
                    $arrProfilePermission=array();
                    $modulesInfo=getModuleInfo("data_item_type");
                    foreach($modulesInfo as $data_item_type=>$modInfo)
                    {
                        $arrProfilePermission[$data_item_type]=array("module"=>$modInfo["modulename"],"data_item_id"=>$data_item_type,0=>0,1=>0,2=>0,3=>0,4=>0);
                    }

                    //$arrSite=array(1,180);
                    $arrSQL=array();

                    $profileid=$_REQUEST["profileid"];
                    $sql="select * from auieo_profiles2permissions where profileid={$profileid} and site_id=".$site_id;
                    $arrAssoc=$objDB->getAllAssoc($sql);
                    if($arrAssoc)
                    {
                        foreach($arrAssoc as $record)
                        {
                            $arrProfilePermission[$record["data_item_type"]][$record["operation"]]=$record["permissions"];
                        }
                    }
                    else
                    {
                        foreach($arrProfilePermission as $data_item_type=>$rowData)
                        {
                            array_shift($rowData);
                            array_shift($rowData);
                            foreach($rowData as $operation=>$permissions)
                            {
                                $arrSQL[]="insert into auieo_profiles2permissions (`profileid`,`data_item_type`,`operation`,`permissions`,`site_id`) 
                                values ('{$profileid}','{$data_item_type}','{$operation}','{$permissions}','{$site_id}')";
                            }
                        }
                    }
                    echo json_encode(array_values($arrProfilePermission));
                    break;
                }
                case 'assign':
                {
                    $sql="select * from auieo_roles2profiles where roleid={$_REQUEST["role"]} && profileid={$_REQUEST["profileid"]}";
                    $arrAssoc=$objDB->getAllAssoc($sql);
                    if(empty($arrAssoc))
                    {
                        $sql="insert into auieo_roles2profiles (roleid,profileid,site_id) values ({$_REQUEST["role"]},{$_REQUEST["profileid"]},{$site_id})";
                        $objDB->query($sql);
                    }
                    break;
                }
                case 'addnew':
                {
                    $sql="insert into auieo_profiles (`profilename`,`site_id`) values ('{$_REQUEST["profilename"]}','{$site_id}')";
                    $objDB->query($sql);
                    echo $objDB->getLastInsertID();
                    break;
                }
                default:
                {
                    $sql="select * from auieo_profiles where site_id=".$_SESSION["CATS"]->getSiteID();
                    $arrAssoc=$objDB->getAllAssoc($sql);
                    foreach($arrAssoc as $ind=>$assoc)
                    {
                        $arrAssoc[$ind]["delete"]="Delete";
                    }
                    echo json_encode($arrAssoc);
                }
            }
            exit;
        }
    }
예제 #9
0
function getTableInfoByModule($_AUIEO_MODULE)
{
    static $arrTableInfo=array();
    if(!isset($arrTableInfo[$_AUIEO_MODULE]))
    {
        $table="";
        $primaryKey="";
        $module="";
        $arrDataItemType=getModuleInfo("modulename");
        if(isset($arrDataItemType[$_AUIEO_MODULE]))
        {
            $table=$arrDataItemType[$_AUIEO_MODULE]["tablename"];
            $primaryKey=$arrDataItemType[$_AUIEO_MODULE]["primarykey"];
            $module=$arrDataItemType[$_AUIEO_MODULE]["modulename"];
            $data_item_type=$arrDataItemType[$_AUIEO_MODULE]["data_item_type_id"];
        }
        $arrTableInfo[$_AUIEO_MODULE] = array("table"=>$table,"primary_key"=>$primaryKey,"module"=>$module,"data_item_type"=>$data_item_type);
    }
    return $arrTableInfo[$_AUIEO_MODULE];
    /*$table="";
    $primaryKey="";
    switch ($module)
    {
        case "candidates":
        {
            $table="candidate";
            $primaryKey="candidate_id";
            $module="candidates";
            $data_item_type=100;
            break;
        }
        case "companies":
        {
            $table="company";
            $primaryKey="company_id";
            $module="companies";
            $data_item_type=200;
            break;
        }
        case "contacts":
        {
            $table="contact";
            $primaryKey="contact_id";
            $module="contacts";
            $data_item_type=300;
            break;
        }
        case "joborders":
        {
            $table="joborder";
            $primaryKey="joborder_id";
            $module="joborders";
            $data_item_type=400;
            break;
        }
    }
    return array("table"=>$table,"primary_key"=>$primaryKey,"module"=>$module,"data_item_type"=>$data_item_type);*/
}
예제 #10
0
function moduleAsset($path = '')
{
    return getModuleInfo() ? asset('modules/' . getModuleInfo()->getName() . '/' . ltrim($path, '/')) : asset($path);
}