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


PHP ModUtil::loadApi方法代码示例

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


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

示例1: getParameters

 /**
  * Returns custom plugin variables.
  *
  * @return array List of variables.
  */
 public function getParameters()
 {
     $objectTypes = array();
     if (ModUtil::available($this->modname) && ModUtil::loadApi($this->modname)) {
         $objectTypes['collection'] = array('name' => $this->__('Collections'));
         $objectTypes['movie'] = array('name' => $this->__('Movies'));
     }
     $active = $this->getPluginVar('ObjectTypes', array());
     foreach ($objectTypes as $k => $v) {
         $objectTypes[$k]['nwactive'] = in_array($k, $active);
     }
     $args = $this->getPluginVar('Args', array());
     return array('number' => 1, 'param' => array('ObjectTypes' => $objectTypes, 'Args' => $args));
 }
开发者ID:robbrandt,项目名称:MUVideo,代码行数:19,代码来源:ItemList.php

示例2: search

    /**
     * Search plugin main function
     **/
    public function search($args)
    {
        if (!SecurityUtil::checkPermission('News::', '::', ACCESS_READ)) {
            return true;
        }

        ModUtil::dbInfoLoad('Search');
        $tables = DBUtil::getTables();
        $newsColumn = $tables['news_column'];

        $where = Search_Api_User::construct_where($args,
                array($newsColumn['title'],
                $newsColumn['hometext'],
                $newsColumn['bodytext']),
                $newsColumn['language']);
        // Only search in published articles that are currently visible
        $where .= " AND ({$newsColumn['published_status']} = '0')";
        $date = DateUtil::getDatetime();
        $where .= " AND ('$date' >= {$newsColumn['from']} AND ({$newsColumn['to']} IS NULL OR '$date' <= {$newsColumn['to']}))";

        $sessionId = session_id();

        ModUtil::loadApi('News', 'user');

        $permChecker = new News_ResultChecker($this->getVar('enablecategorization'), $this->getVar('enablecategorybasedpermissions'));
        $articles = DBUtil::selectObjectArrayFilter('news', $where, null, null, null, '', $permChecker, null);

        foreach ($articles as $article)
        {
            $item = array(
                'title' => $article['title'],
                'text'  => $article['hometext'],
                'extra' => $article['sid'],
                'created' => $article['from'],
                'module'  => 'News',
                'session' => $sessionId
            );
            $insertResult = DBUtil::insertObject($item, 'search_result');
            if (!$insertResult) {
                return LogUtil::registerError($this->__('Error! Could not load any articles.'));
            }
        }

        return true;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:48,代码来源:Search.php

示例3: upgrade

 /**
  * upgrade module
  */
 public function upgrade($oldversion)
 {
     switch ($oldversion) {
         case '2.1':
             // reset all modvars to default
             $this->setVar('smiliepath', 'modules/BBSmile/images/smilies');
             $this->setVar('activate_auto', '1');
             $this->setVar('remove_inactive', '1');
             $this->setVar('smiliepath_auto', 'modules/BBSmile/images/smilies_auto');
             $this->setVar('smilie_array', BBSmile_Util::getDefaultSmilies());
             // load the 'auto' smilies
             ModUtil::loadApi($this->name, 'admin', true);
             ModUtil::apiFunc($this->name, 'admin', 'updatesmilies', array('forcereload' => 1));
             // create hook
             HookUtil::registerProviderBundles($this->version->getHookProviderBundles());
         case '3.0.0':
             // current version
     }
     return true;
 }
开发者ID:rmaiwald,项目名称:BBSmile,代码行数:23,代码来源:Installer.php

示例4: install

    /**
     * initialise the theme module
     *
     * This function is only ever called once during the lifetime of a particular
     * module instance.
     * This function MUST exist in the pninit file for a module
     *
     * @return bool true on success, false otherwise
     */
    public function install()
    {
        // create the table
        if (!DBUtil::createTable('themes')) {
            return false;
        }

        // detect all themes on install
        ModUtil::loadApi('Theme', 'admin', true);
        ModUtil::apiFunc('Theme', 'admin', 'regenerate');

        // define defaults for module vars
        $this->setVar('modulesnocache', '');
        $this->setVar('enablecache', false);
        $this->setVar('compile_check', true);
        $this->setVar('cache_lifetime', 1800);
        $this->setVar('cache_lifetime_mods', 1800);
        $this->setVar('force_compile', false);
        $this->setVar('trimwhitespace', false);
        $this->setVar('maxsizeforlinks', 30);
        $this->setVar('itemsperpage', 25);

        $this->setVar('cssjscombine', false);
        $this->setVar('cssjscompress', false);
        $this->setVar('cssjsminify', false);
        $this->setVar('cssjscombine_lifetime', 3600);

        // View
        $this->setVar('render_compile_check',  true);
        $this->setVar('render_force_compile',  false);
        $this->setVar('render_cache',          true);
        $this->setVar('render_expose_template',false);
        $this->setVar('render_lifetime',       3600);

        // Initialisation successful
        return true;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:46,代码来源:Installer.php

示例5: internalUserAccountValidation

 private static function internalUserAccountValidation($uid, $reportErrors = false, $userObj = false)
 {
     if (!$uid || !is_numeric($uid) || (int) $uid != $uid) {
         // We got something other than a uid from the authentication process.
         if (!LogUtil::hasErrors() && $reportErrors) {
             LogUtil::registerError(__('Sorry! Login failed. The information you provided was incorrect.'));
         }
     } else {
         if (!$userObj) {
             // Need to make sure the Users module stuff is loaded and available, especially if we are authenticating during
             // an upgrade or install.
             ModUtil::loadApi('Users', 'user', true);
             // The user's credentials have authenticated with the authentication module's method, but
             // now we have to check the account status itself. If the account status would not allow the
             // user to log in, then we return false.
             $userObj = self::getVars($uid);
             if (!$userObj) {
                 // Might be a registration
                 $userObj = self::getVars($uid, false, 'uid', true);
             }
         }
         if (!$userObj || !is_array($userObj)) {
             // Note that we have not actually logged into anything yet, just authenticated.
             throw new Zikula_Exception_Fatal(__f('A %1$s (%2$s) was returned by the authenticating module, but a user account record (or registration request record) could not be found.', array('uid', $uid)));
         }
         if (!isset($userObj['activated'])) {
             // Provide a sane value.
             $userObj['activated'] = UsersConstant::ACTIVATED_INACTIVE;
         }
         if ($userObj['activated'] != UsersConstant::ACTIVATED_ACTIVE) {
             if ($reportErrors) {
                 $displayVerifyPending = ModUtil::getVar(UsersConstant::MODNAME, UsersConstant::MODVAR_LOGIN_DISPLAY_VERIFY_STATUS, UsersConstant::DEFAULT_LOGIN_DISPLAY_VERIFY_STATUS);
                 $displayApprovalPending = ModUtil::getVar(UsersConstant::MODNAME, UsersConstant::MODVAR_LOGIN_DISPLAY_APPROVAL_STATUS, UsersConstant::DEFAULT_LOGIN_DISPLAY_VERIFY_STATUS);
                 if ($userObj['activated'] == UsersConstant::ACTIVATED_PENDING_REG && ($displayApprovalPending || $displayVerifyPending)) {
                     $moderationOrder = ModUtil::getVar(UsersConstant::MODNAME, UsersConstant::MODVAR_REGISTRATION_APPROVAL_SEQUENCE, UsersConstant::DEFAULT_REGISTRATION_APPROVAL_SEQUENCE);
                     if (!$userObj['isverified'] && ($moderationOrder == UsersConstant::APPROVAL_AFTER || $moderationOrder == UsersConstant::APPROVAL_ANY || !empty($userObj['approved_by'])) && $displayVerifyPending) {
                         $message = __('Your request to register with this site is still waiting for verification of your e-mail address. Please check your inbox for a message from us.');
                     } elseif (empty($userObj['approved_by']) && ($moderationOrder == UsersConstant::APPROVAL_BEFORE || $moderationOrder == UsersConstant::APPROVAL_ANY) && $displayApprovalPending) {
                         $message = __('Your request to register with this site is still waiting for approval from a site administrator.');
                     }
                     if (isset($message) && !empty($message)) {
                         return LogUtil::registerError($message);
                     }
                     // It is a pending registration but the site admin elected to not display this to the user.
                     // No exception here because the answer is simply "no." This will fall through to return false.
                 } elseif ($userObj['activated'] == UsersConstant::ACTIVATED_INACTIVE && ModUtil::getVar(UsersConstant::MODNAME, UsersConstant::MODVAR_LOGIN_DISPLAY_INACTIVE_STATUS, UsersConstant::DEFAULT_LOGIN_DISPLAY_INACTIVE_STATUS)) {
                     $message = __('Your account has been disabled. Please contact a site administrator for more information.');
                 } elseif ($userObj['activated'] == UsersConstant::ACTIVATED_PENDING_DELETE && ModUtil::getVar(UsersConstant::MODNAME, UsersConstant::MODVAR_LOGIN_DISPLAY_DELETE_STATUS, UsersConstant::DEFAULT_LOGIN_DISPLAY_DELETE_STATUS)) {
                     $message = __('Your account has been disabled and is scheduled for removal. Please contact a site administrator for more information.');
                 } else {
                     $message = __('Sorry! Either there is no active user in our system with that information, or the information you provided does not match the information for your account.');
                 }
                 LogUtil::registerError($message);
             }
             $userObj = false;
         }
     }
     return $userObj;
 }
开发者ID:rtznprmpftl,项目名称:Zikulacore,代码行数:59,代码来源:UserUtil.php

示例6: defaultdata

    /**
     * Add default block data for new installs
     * This is called after a complete pn installation since the blocks
     * need to be populated with module id's which are only available
     * once the install has been completed
     */
    public function defaultdata()
    {
        // load block api
        ModUtil::loadApi('Blocks', 'admin', true);

        // sanity check - truncate existing tables to ensure a clean blocks setup
        $connection = $this->entityManager->getConnection();
        $platform = $connection->getDatabasePlatform();
        $connection->executeUpdate($platform->getTruncateTableSQL('blocks', true));
        $connection->executeUpdate($platform->getTruncateTableSQL('block_positions', true));
        $connection->executeUpdate($platform->getTruncateTableSQL('block_placements', true));

        // create the default block positions - left, right and center for the traditional 3 column layout
        $left = ModUtil::apiFunc('Blocks', 'admin', 'createposition', array('name' => 'left', 'description' => $this->__('Left blocks')));
        $right = ModUtil::apiFunc('Blocks', 'admin', 'createposition', array('name' => 'right', 'description' => $this->__('Right blocks')));
        $center = ModUtil::apiFunc('Blocks', 'admin', 'createposition', array('name' => 'center', 'description' => $this->__('Center blocks')));
        $search = ModUtil::apiFunc('Blocks', 'admin', 'createposition', array('name' => 'search', 'description' => $this->__('Search block')));
        $header = ModUtil::apiFunc('Blocks', 'admin', 'createposition', array('name' => 'header', 'description' => $this->__('Header block')));
        $footer = ModUtil::apiFunc('Blocks', 'admin', 'createposition', array('name' => 'footer', 'description' => $this->__('Footer block')));
        $topnav = ModUtil::apiFunc('Blocks', 'admin', 'createposition', array('name' => 'topnav', 'description' => $this->__('Top navigation block')));
        $bottomnav = ModUtil::apiFunc('Blocks', 'admin', 'createposition', array('name' => 'bottomnav', 'description' => $this->__('Bottom navigation block')));

        // define an array of the default blocks
        $blocks = array();

        // build the menu content
        $languages = ZLanguage::getInstalledLanguages();
        $saveLanguage = ZLanguage::getLanguageCode();
        $menucontent = array();
        $topnavcontent = array();
        foreach ($languages as $lang) {
            ZLanguage::setLocale($lang);
            ZLanguage::bindCoreDomain();

            $menucontent['displaymodules'] = '0';
            $menucontent['stylesheet'] = 'extmenu.css';
            $menucontent['template'] = 'blocks_block_extmenu.tpl';
            $menucontent['blocktitles'][$lang] = $this->__('Main menu');

            // insert the links
            $menucontent['links'][$lang][] = array('name' => $this->__('Home'), 'url' => '{homepage}', 'title' => $this->__("Go to the home page"), 'level' => 0, 'parentid' => null, 'image' => '', 'active' => '1');
            $menucontent['links'][$lang][] = array('name' => $this->__('Administration'), 'url' => '{Admin:admin:adminpanel}', 'title' => $this->__('Go to the site administration'), 'level' => 0, 'parentid' => null, 'image' => '', 'active' => '1');
            $menucontent['links'][$lang][] = array('name' => $this->__('My Account'), 'url' => '{Users}', 'title' => $this->__('Go to your account panel'), 'level' => 0, 'parentid' => null, 'image' => '', 'active' => '1');
            $menucontent['links'][$lang][] = array('name' => $this->__('Log out'), 'url' => '{Users:user:logout}', 'title' => $this->__('Log out of this site'), 'level' => 0, 'parentid' => null, 'image' => '', 'active' => '1');
            $menucontent['links'][$lang][] = array('name' => $this->__('Site search'), 'url' => '{Search}', 'title' => $this->__('Search this site'), 'level' => 0, 'parentid' => null, 'image' => '', 'active' => '1');

            $topnavcontent['displaymodules'] = '0';
            $topnavcontent['stylesheet'] = 'extmenu.css';
            $topnavcontent['template'] = 'blocks_block_extmenu_topnav.tpl';
            $topnavcontent['blocktitles'][$lang] = $this->__('Top navigation');

            // insert the links
            $topnavcontent['links'][$lang][] = array('name' => $this->__('Home'), 'url' => '{homepage}', 'title' => $this->__("Go to the site's home page"), 'level' => 0, 'parentid' => null, 'image' => '', 'active' => '1');
            $topnavcontent['links'][$lang][] = array('name' => $this->__('My Account'), 'url' => '{Users}', 'title' => $this->__('Go to your account panel'), 'level' => 0, 'parentid' => null, 'image' => '', 'active' => '1');
            $topnavcontent['links'][$lang][] = array('name' => $this->__('Site search'), 'url' => '{Search}', 'title' => $this->__('Search this site'), 'level' => 0, 'parentid' => null, 'image' => '', 'active' => '1');
        }

        ZLanguage::setLocale($saveLanguage);

        $menucontent = serialize($menucontent);
        $topnavcontent = serialize($topnavcontent);
        $searchcontent = array('displaySearchBtn' => 1,
                               'active' => array('Users' => 1));
        $searchcontent = serialize($searchcontent);

        $hellomessage = $this->__('<p><a href="http://zikula.org/">Zikula</a> is a content management system (CMS) and application framework. It is secure and stable, and is a good choice for sites with a large volume of traffic.</p><p>With Zikula:</p><ul><li>you can customise all aspects of the site\'s appearance through themes, with support for CSS style sheets, JavaScript, Flash and all other modern web development technologies;</li><li>you can mark content as being suitable for either a single language or for all languages, and can control all aspects of localisation and internationalisation of your site;</li><li>you can be sure that your pages will display properly in all browsers, thanks to Zikula\'s full compliance with W3C HTML standards;</li><li>you get a standard application-programming interface (API) that lets you easily augment your site\'s functionality through modules, blocks and other extensions;</li><li>you can get help and support from the Zikula community of webmasters and developers at <a href="http://www.zikula.org">zikula.org</a>.</li></ul><p>Enjoy using Zikula!</p><p><strong>The Zikula team</strong></p><p><em>Note: Zikula is Free Open Source Software (FOSS) licensed under the GNU General Public License.</em></p>');
        $blocks[] = array('bkey' => 'Extmenu', 'collapsable' => 1, 'defaultstate' => 1, 'language' => '', 'mid' => ModUtil::getIdFromName('Blocks'), 'title' => $this->__('Main menu'), 'description' => $this->__('Main menu'), 'content' => $menucontent, 'positions' => array($left));
        $blocks[] = array('bkey' => 'Search', 'collapsable' => 1, 'defaultstate' => 1, 'language' => '', 'mid' => ModUtil::getIdFromName('Search'), 'title' => $this->__('Search box'), 'description' => $this->__('Search block'), 'content' => $searchcontent, 'positions' => array($search));
        $blocks[] = array('bkey' => 'Html', 'collapsable' => 1, 'defaultstate' => 1, 'language' => '', 'mid' => ModUtil::getIdFromName('Blocks'), 'title' => $this->__("This site is powered by Zikula!"), 'description' => $this->__('HTML block'), 'content' => $hellomessage, 'positions' => array($center));
        $blocks[] = array('bkey' => 'Login', 'collapsable' => 1, 'defaultstate' => 1, 'language' => '', 'mid' => ModUtil::getIdFromName('Users'), 'title' => $this->__('User log-in'), 'description' => $this->__('Login block'), 'positions' => array($right));
        //$blocks[] = array('bkey' => 'Online', 'collapsable' => 1, 'defaultstate' => 1, 'language' => '', 'mid' => ModUtil::getIdFromName('Users'), 'title' => $this->__('Who\'s on-line'), 'description' => $this->__('Online block'), 'positions' => array($right));
        $blocks[] = array('bkey' => 'Extmenu', 'collapsable' => 1, 'defaultstate' => 1, 'language' => '', 'mid' => ModUtil::getIdFromName('Blocks'), 'title' => $this->__('Top navigation'), 'description' => $this->__('Theme navigation'), 'content' => $topnavcontent, 'positions' => array($topnav));

        // create each block and then update the block
        // the create creates the initial block record, the update sets the block placement
        foreach ($blocks as $position => $block) {
            ModUtil::apiFunc('Blocks', 'admin', 'create', $block);
        }

        return;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:87,代码来源:Installer.php

示例7: update_hour

    public function update_hour($args) {
        if (!SecurityUtil::checkPermission('IWtimeframes::', "::", ACCESS_ADMIN)) {
            return LogUtil::registerError($this->__('Not authorized to manage timeFrames.'), 403);
        }

        $hid = FormUtil::getPassedValue('hid', isset($args['hid']) ? $args['hid'] : null, 'GET');
        $start = FormUtil::getPassedValue('start', isset($args['start']) ? $args['start'] : null, 'GET');
        $end = FormUtil::getPassedValue('end', isset($args['end']) ? $args['end'] : null, 'GET');
        $descriu = FormUtil::getPassedValue('descriu', isset($args['descriu']) ? $args['descriu'] : null, 'GET');

        //Comprovem que els valors han arribat
        if ((!isset($hid)) or (!isset($start)) or (!isset($end))) {
            return LogUtil::registerError($this->__('Error! Could not do what you wanted. Please check your input.'));
        }

        //Carregem l'API de l'usuari per poder consultar les dades de l'hora que volem modificar
        if (!ModUtil::loadApi('IWtimeframes', 'user')) {
            return LogUtil::registerError($this->__('Error! Could not load module.'));
        }

        //Cridem la funciᅵ get de l'API que ens retornarᅵ les dades de l'hora
        $registre = ModUtil::apiFunc('IWtimeframes', 'user', 'get_hour', array('hid' => $hid));

        //Comprovem que la consulta anterior ha tornat amb resultats
        if ($registre == false) {
            return LogUtil::registerError($this->__('Could not find the time over to do the action'));
        }

        //Comprovacions de seguretat
        if (!SecurityUtil::checkPermission('IWtimeframes::', "$registre[hora]::$hid", ACCESS_EDIT)) {
            return LogUtil::registerError($this->__('Not authorized to manage timeFrames.'));
        }

        $where = "hid=" . $hid;
        $item = array('start' => $start, 'end' => $end, 'descriu' => $descriu);
        $tablename = 'IWtimeframes';
        if (!DBUtil::updateObject($item, $tablename, $where)) {
            return LogUtil::registerError($this->__('The modify of the frame time failed.'));
        }

        return true;
    }
开发者ID:projectesIF,项目名称:Sirius,代码行数:42,代码来源:Admin.php

示例8: _upg_upgrademodules

/**
 * Generate the upgrade module page.
 *
 * This function upgrade available module to an upgrade
 *
 * @param string $username Username of the admin user.
 * @param string $password Password of the admin user.
 *
 * @return void
 */
function _upg_upgrademodules($username, $password)
{
    _upg_header();
    $modvars = DBUtil::selectObjectArray('module_vars');
    foreach ($modvars as $modvar) {
        if ($modvar['value'] == '0' || $modvar['value'] == '1') {
            $modvar['value'] = serialize($modvar['value']);
            DBUtil::updateObject($modvar, 'module_vars');
        }
    }
    // force load the modules admin API
    ModUtil::loadApi('Extensions', 'admin', true);
    echo '<h2>' . __('Starting upgrade') . '</h2>' . "\n";
    echo '<ul id="upgradelist" class="check">' . "\n";
    // reset for User module
    //$GLOBALS['_ZikulaUpgrader']['_ZikulaUpgradeFrom12x'] = false;
    $results = ModUtil::apiFunc('Extensions', 'admin', 'upgradeall');
    if ($results) {
        foreach ($results as $modname => $result) {
            if ($result) {
                echo '<li class="passed">' . DataUtil::formatForDisplay($modname) . ' ' . __('upgraded') . '</li>' . "\n";
            } else {
                echo '<li class="failed">' . DataUtil::formatForDisplay($modname) . ' ' . __('not upgraded') . '</li>' . "\n";
            }
        }
    }
    echo '</ul>' . "\n";
    if (!$results) {
        echo '<ul class="check"><li class="passed">' . __('No modules required upgrading') . '</li></ul>';
    }
    // wipe out the deprecated modules from Modules list.
    $modTable = 'modules';
    $sql = "DELETE FROM {$modTable} WHERE name = 'Header_Footer' OR name = 'AuthPN' OR name = 'pnForm' OR name = 'Workflow' OR name = 'pnRender' OR name = 'Admin_Messages'";
    DBUtil::executeSQL($sql);
    // store localized displayname and description for Extensions module
    $extensionsDisplayname = __('Extensions');
    $extensionsDescription = __('Manage your modules and plugins.');
    $sql = "UPDATE modules SET name = 'Extensions', displayname = '{$extensionsDisplayname}', description = '{$extensionsDescription}' WHERE modules.name = 'Extensions'";
    DBUtil::executeSQL($sql);
    // regenerate the themes list
    ModUtil::apiFunc('Theme', 'admin', 'regenerate');
    // store the recent version in a config var for later usage. This enables us to determine the version we are upgrading from
    System::setVar('Version_Num', Zikula_Core::VERSION_NUM);
    System::setVar('language_i18n', ZLanguage::getLanguageCode());
    // Relogin the admin user to give a proper admin link
    SessionUtil::requireSession();
    echo '<p class="z-statusmsg">' . __('Finished upgrade') . " - \n";
    $authenticationInfo = array('login_id' => $username, 'pass' => $password);
    $authenticationMethod = array('modname' => 'Users', 'method' => 'uname');
    if (!UserUtil::loginUsing($authenticationMethod, $authenticationInfo)) {
        $url = sprintf('<a href="%s">%s</a>', DataUtil::formatForDisplay(System::getBaseUrl()), DataUtil::formatForDisplay(System::getVar('sitename')));
        echo __f('Go to the startpage for %s', $url);
    } else {
        upgrade_clear_caches();
        $url = sprintf('<a href="%s">%s</a>', ModUtil::url('Admin', 'admin', 'adminpanel'), DataUtil::formatForDisplay(System::getVar('sitename')));
        echo __f('Go to the admin panel for %s', $url);
    }
    echo "</p>\n";
    _upg_footer();
}
开发者ID:Git-Host,项目名称:AMPPS,代码行数:70,代码来源:orig_upgrade.php

示例9: pnModAPILoad

/**
 * Load an API module.
 *
 * @deprecated
 * @see ModUtil::loadApi()
 *
 * @param string  $modname The name of the module.
 * @param string  $type    The type of functions to load.
 * @param boolean $force   Determines to load Module even if module isn't active.
 *
 * @return string|boolean Name of module loaded, or false on failure.
 */
function pnModAPILoad($modname, $type = 'user', $force = false)
{
    LogUtil::log(__f('Warning! Function %1$s is deprecated. Please use %2$s instead.', array(__FUNCTION__, 'ModUtil::loadApi()')), E_USER_DEPRECATED);
    return ModUtil::loadApi($modname, $type, $force);
}
开发者ID:,项目名称:,代码行数:17,代码来源:

示例10: upgradeModules

 private function upgradeModules()
 {
     // force load the modules admin API
     \ModUtil::loadApi('ZikulaExtensionsModule', 'admin', true);
     // this also regenerates all the modules
     return \ModUtil::apiFunc('ZikulaExtensionsModule', 'admin', 'upgradeall');
     // returns array(array(modname => boolean))
 }
开发者ID:Silwereth,项目名称:core,代码行数:8,代码来源:AjaxUpgradeController.php

示例11: search

 /**
  * Search plugin main function
  **/
 public function search($args)
 {
     // Permission check
     $this->throwForbiddenUnless(SecurityUtil::checkPermission('AddressBook::', '::', ACCESS_READ), LogUtil::getErrorMsgPermission());
     ModUtil::dbInfoLoad('Search');
     $ztable = DBUtil::getTables();
     $addresstable = $ztable['addressbook_address'];
     $addresscolumn = $ztable['addressbook_address_column'];
     $searchTable = $ztable['search_result'];
     $searchColumn = $ztable['search_result_column'];
     $searchcols = array($addresscolumn['lname'], $addresscolumn['fname'], $addresscolumn['company'], $addresscolumn['city'], $addresscolumn['zip'], $addresscolumn['address1'], $addresscolumn['address2'], $addresscolumn['state'], $addresscolumn['country'], $addresscolumn['contact_1'], $addresscolumn['contact_2'], $addresscolumn['contact_3'], $addresscolumn['contact_4'], $addresscolumn['contact_5']);
     $cusfields = DBUtil::selectFieldArray('addressbook_customfields', 'id');
     // Get user id
     if (UserUtil::isLoggedIn()) {
         $user_id = UserUtil::getVar('uid');
     } else {
         $user_id = 0;
     }
     for ($i = 0; $i < count($cusfields); $i++) {
         $colname = 'custom_' . $cusfields[$i];
         array_push($searchcols, $addresscolumn[$colname]);
     }
     $where = search_construct_where($args, $searchcols);
     // admin always sees all records but favorites
     if (SecurityUtil::checkPermission('AddressBook::', '::', ACCESS_ADMIN)) {
         $where .= " AND ({$addresscolumn['user_id']} IS NOT NULL)";
     } else {
         // global protect - users see only their own records (admin sees all)
         if (ModUtil::getVar('AddressBook', 'globalprotect') == 1 && !SecurityUtil::checkPermission('AddressBook::', '::', ACCESS_ADMIN)) {
             $where .= " AND ({$addresscolumn['user_id']}={$user_id})";
         } else {
             // if private = 1, show only private records
             if ($private == 1) {
                 $where .= " AND ({$addresscolumn['user_id']}={$user_id} AND {$addresscolumn['private']} = 1)";
             } else {
                 // if private = 0, show all records
                 $where .= " AND (({$addresscolumn['private']} = 0) OR ({$addresscolumn['user_id']}={$user_id} AND {$addresscolumn['private']} = 1))";
             }
         }
     }
     $sessionId = session_id();
     $insertSql = "INSERT INTO {$searchTable}\n  ({$searchColumn['title']},\n  {$searchColumn['text']},\n  {$searchColumn['extra']},\n  {$searchColumn['module']},\n  {$searchColumn['created']},\n  {$searchColumn['session']})\n    VALUES ";
     ModUtil::loadApi('AddressBook', 'user');
     if (ModUtil::getVar('AddressBook', 'addressbooktype') == 1) {
         $sort = "sortname DESC,sortcompany DESC";
     } else {
         $sort = "sortcompany DESC,sortname DESC";
     }
     $permChecker = new addressbook_result_checker();
     //$addresses = DBUtil::selectObjectArray('addressbook_address', $where, null, null, '', $permChecker, null);
     $addresses = DBUtil::selectObjectArrayFilter('addressbook_address', $where, null, null, null, '', $permChecker, null);
     foreach ($addresses as $address) {
         $line_1 = $address['fname'] . " " . $address['lname'];
         if (empty($line_1)) {
             $line_1 = $address['company'];
         } else {
             if (!empty($address['company'])) {
                 $line_1 .= " [" . $address['company'] . "]";
             }
         }
         if (ModUtil::getVar('AddressBook', 'zipbeforecity') == 1) {
             $line_2 = $address['zip'] . " " . $address['city'];
         } else {
             $line_2 = $address['city'] . " " . $address['zip'];
         }
         $sql = $insertSql . '(' . '\'' . DataUtil::formatForStore($line_1) . '\', ' . '\'' . DataUtil::formatForStore($line_2) . '\', ' . '\'' . DataUtil::formatForStore($address['id']) . '\', ' . '\'' . 'AddressBook' . '\', ' . '\'' . DataUtil::formatForStore($address['cr_date']) . '\', ' . '\'' . DataUtil::formatForStore($sessionId) . '\')';
         $insertResult = DBUtil::executeSQL($sql);
         if (!$insertResult) {
             return LogUtil::registerError($this->__('Error! Could not load addresses.'));
         }
     }
     return true;
 }
开发者ID:nmpetkov,项目名称:AddressBook,代码行数:76,代码来源:Search.php

示例12: adminlinks

 /**
  * Return list of admin modules
  *
  * Syntax used in menutree
  * {ext:Blocks:adminlinks:[flat,category]}
  * Last param is optional.  It can be flat and/or category separated by a comma.
  * 'flat' will add the admin links in the current menu.  Without 'flat' the links are grouped one level down
  * 'category' additionally groups the admin links by their category.
  * You can combine 'flat' and 'category' to have the category links added in the current menu.
  *
  * @param array $args['item'] menu node to be replaced
  * @param string $args['lang'] current menu language
  * @param string $args['extrainfo'] additional params - if 'flat' then return links ungrouped. if 'category' module links grouped by category
  * @return mixed array of links if successful, false otherwise
  */
 public function adminlinks($args)
 {
     $item = isset($args['item']) && !empty($args['item']) ? $args['item'] : null;
     $lang = isset($args['lang']) && !empty($args['lang']) ? $args['lang'] : null;
     $extrainfo = isset($args['extrainfo']) && !empty($args['extrainfo']) ? $args['extrainfo'] : null;
     // $item ang lang params are required
     if (!$item || !$lang) {
         return false;
     }
     // Convert extrainfo into flags
     $extrainfo = $extrainfo ? preg_split("/[\\s]*,[\\s]*/", trim($extrainfo)) : array();
     $flag = array();
     $flag['flat'] = in_array("flat", $extrainfo);
     //now true or false
     $flag['category'] = in_array("category", $extrainfo);
     //now true or false
     // Make sure admin API is loaded
     if (!ModUtil::loadApi('Admin', 'admin', true)) {
         return false;
     }
     if (!SecurityUtil::checkPermission('Admin::', "::", ACCESS_EDIT)) {
         return array();
         // Since no permission, return empty links
     }
     // get id for first element, use api func to aviod id conflicts inside menu
     $idoffset = Blocks_MenutreeUtil::getIdOffset($item['id']);
     $lineno = 0;
     $links = array();
     // if not flat, group the links into a single menu entry
     if (!$flag['flat']) {
         $links['adminlinks'] = array($lang => array('id' => $idoffset++, 'name' => $item['name'], 'href' => ModUtil::url('Admin', 'admin', 'adminpanel'), 'title' => $item['title'], 'className' => $item['className'], 'state' => $item['state'], 'lang' => $lang, 'lineno' => $lineno++, 'parent' => $item['parent']));
     }
     // need to set parent node id - if links are grouped - use your_accont item id
     // otherwise parent id of replaced menu node
     $parentNode = !$flag['flat'] ? $links['adminlinks'][$lang]['id'] : $item['parent'];
     // First work on the Admin module categories
     $catinfo = array();
     // used to store menu information for the categories
     $catlinks = array();
     if ($flag['category']) {
         // Get all the Categories
         $categories = ModUtil::apiFunc('Admin', 'admin', 'getall');
         foreach ($categories as $item) {
             if (SecurityUtil::checkPermission('Admin::', "{$item['catname']}::{$item['cid']}", ACCESS_EDIT)) {
                 // Set up the menu information for this category
                 $catinfo[$item['cid']] = array('id' => $idoffset, 'no' => 0);
                 $catlinks[] = array($lang => array('id' => $idoffset++, 'name' => $item['catname'], 'href' => ModUtil::url('Admin', 'admin', 'adminpanel', array('acid' => $item['cid'])), 'title' => $item['description'], 'className' => '', 'state' => 1, 'lang' => $lang, 'lineno' => $lineno++, 'parent' => $parentNode));
             }
         }
     }
     // Now work on admin capable modules
     $adminmodules = ModUtil::getAdminMods();
     $displayNameType = ModUtil::getVar('Admin', 'displaynametype', 1);
     $default_cid = ModUtil::getVar('Admin', 'startcategory');
     $adminlinks = array();
     foreach ($adminmodules as $adminmodule) {
         if (SecurityUtil::checkPermission("{$adminmodule['name']}::", '::', ACCESS_EDIT)) {
             $cid = ModUtil::apiFunc('Admin', 'admin', 'getmodcategory', array('mid' => ModUtil::getIdFromName($adminmodule['name'])));
             $cid = isset($catinfo[$cid]) ? $cid : $default_cid;
             // make sure each module is assigned a category
             $modinfo = ModUtil::getInfo(ModUtil::getIdFromName($adminmodule['name']));
             if ($modinfo['type'] == 2 || $modinfo['type'] == 3) {
                 $menutexturl = ModUtil::url($modinfo['name'], 'admin');
             } else {
                 $menutexturl = 'admin.php?module=' . $modinfo['name'];
             }
             if ($displayNameType == 1) {
                 $menutext = $modinfo['displayname'];
             } elseif ($displayNameType == 2) {
                 $menutext = $modinfo['name'];
             } elseif ($displayNameType == 3) {
                 $menutext = $modinfo['displayname'] . ' (' . $modinfo['name'] . ')';
             }
             $adminlinks[] = array($lang => array('id' => $idoffset++, 'name' => $menutext, 'href' => $menutexturl, 'title' => $modinfo['description'], 'className' => '', 'state' => 1, 'lang' => $lang, 'lineno' => $flag['category'] ? $catinfo[$cid]['no']++ : $lineno++, 'parent' => $flag['category'] ? $catinfo[$cid]['id'] : $parentNode));
         }
     }
     $links = array_merge($links, $catlinks, $adminlinks);
     return $links;
 }
开发者ID:,项目名称:,代码行数:94,代码来源:


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