本文整理汇总了PHP中Xoops类的典型用法代码示例。如果您正苦于以下问题:PHP Xoops类的具体用法?PHP Xoops怎么用?PHP Xoops使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Xoops类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: sessionStart
/**
* Configure and start the session
*
* @return void
*/
public function sessionStart()
{
/**
* Revisit this once basics are working
*
* grab session_id from https login form
*
* if ($xoops->getConfig('use_ssl')
* && isset($_POST[$xoops->getConfig('sslpost_name')])
* && $_POST[$xoops->getConfig('sslpost_name')] != ''
* ) {
* session_id($_POST[$xoops->getConfig('sslpost_name')]);
* } else { set session_name...}
*/
$name = $this->xoops->getConfig('session_name');
$name = empty($name) ? 'xoops_session' : $name;
$expire = (int) $this->xoops->getConfig('session_expire');
$expire = $expire > 0 ? $expire : 300;
$path = \XoopsBaseConfig::get('cookie-path');
$domain = \XoopsBaseConfig::get('cookie-domain');
$secure = $this->httpRequest->is('ssl');
session_name($name);
session_cache_expire($expire);
session_set_cookie_params(0, $path, $domain, $secure, true);
$sessionHandler = new Handler();
session_set_save_handler($sessionHandler);
session_register_shutdown();
session_start();
// if session is empty, make sure it isn't using a passed in id
if (empty($_SESSION)) {
$this->regenerateSession();
}
// Make sure the session hasn't expired, and destroy it if it has
if (!$this->validateSession()) {
$this->clearSession();
return;
}
// Check to see if the session shows sign of hijacking attempt
if (!$this->fingerprint->checkSessionPrint($this)) {
$this->regenerateSession();
// session data already cleared, just needs new id
return;
}
// establish valid user data in session, possibly clearing or adding from
// RememberMe mechanism as needed
$this->sessionUser->establish();
// Give a 5% chance of the session id changing on any authenticated request
//if ($this->has('xoopsUserId') && (rand(1, 100) <= 5)) {
if (rand(1, 100) <= 5) {
$this->expireSession();
}
}
开发者ID:RanLee,项目名称:XoopsCore,代码行数:57,代码来源:Manager.php
示例2: getPlugins
/**
* @param string $pluginName
* @param array|bool $inactiveModules
*
* @return mixed
*/
public static function getPlugins($pluginName = 'system', $inactiveModules = false)
{
static $plugins = array();
if (!isset($plugins[$pluginName])) {
$plugins[$pluginName] = array();
$xoops = \Xoops::getInstance();
//Load interface for this plugin
if (!\XoopsLoad::loadFile($xoops->path("modules/{$pluginName}/class/plugin/interface.php"))) {
return $plugins[$pluginName];
}
$dirnames = $xoops->getActiveModules();
if (is_array($inactiveModules)) {
$dirnames = array_merge($dirnames, $inactiveModules);
}
foreach ($dirnames as $dirname) {
if (\XoopsLoad::loadFile($xoops->path("modules/{$dirname}/class/plugin/{$pluginName}.php"))) {
$className = '\\' . ucfirst($dirname) . ucfirst($pluginName) . 'Plugin';
$interface = '\\' . ucfirst($pluginName) . 'PluginInterface';
$class = new $className($dirname);
if ($class instanceof \Xoops\Module\Plugin\PluginAbstract && $class instanceof $interface) {
$plugins[$pluginName][$dirname] = $class;
}
}
}
}
return $plugins[$pluginName];
}
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:33,代码来源:Plugin.php
示例3: smarty_function_xoPageNav
function smarty_function_xoPageNav($params, &$smarty)
{
$xoops = Xoops::getInstance();
extract($params);
if ($pageSize < 1) {
$pageSize = 10;
}
$pagesCount = (int) ($itemsCount / $pageSize);
if ($itemsCount <= $pageSize || $pagesCount < 2) {
return '';
}
$str = '';
$currentPage = (int) ($offset / $pageSize) + 1;
$lastPage = (int) ($itemsCount / $pageSize) + 1;
$minPage = min(1, ceil($currentPage - $linksCount / 2));
$maxPage = max($lastPage, floor($currentPage + $linksCount / 2));
//TODO Remove this hardocded strings
if ($currentPage > 1) {
$str .= '<a href="' . $xoops->url(str_replace('%s', $offset - $pageSize, $url)) . '">Previous</a>';
}
for ($i = $minPage; $i <= $maxPage; ++$i) {
$tgt = htmlspecialchars($xoops->url(str_replace('%s', ($i - 1) * $pageSize, $url)), ENT_QUOTES);
$str .= "<a href='{$tgt}'>{$i}</a>";
}
if ($currentPage < $lastPage) {
$str .= '<a href="' . $xoops->url(str_replace('%s', $offset + $pageSize, $url)) . '">Next</a>';
}
$class = @(!empty($class)) ? htmlspecialchars($class, ENT_QUOTES) : 'pagenav';
$str = "<div class='{$class}'>{$str}</div>";
return $str;
}
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:31,代码来源:function.xoPageNav.php
示例4: execute
/**
* execute the command
*
* @param InputInterface $input input handler
* @param OutputInterface $output output handler
* @return void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$xoops = \Xoops::getInstance();
$module = $input->getArgument('module');
if (false === \XoopsLoad::fileExists($xoops->path("modules/{$module}/xoops_version.php"))) {
$output->writeln(sprintf('<error>No module named %s found!</error>', $module));
return;
}
$output->writeln(sprintf('Installing %s', $module));
if (false !== $xoops->getModuleByDirname($module)) {
$output->writeln(sprintf('<error>%s module is already installed!</error>', $module));
return;
}
$xoops->setTpl(new XoopsTpl());
\XoopsLoad::load('module', 'system');
$sysmod = new \SystemModule();
$result = $sysmod->install($module);
foreach ($sysmod->trace as $message) {
if (is_array($message)) {
foreach ($message as $subMessage) {
if (!is_array($subMessage)) {
$output->writeln(strip_tags($subMessage));
}
}
} else {
$output->writeln(strip_tags($message));
}
}
if ($result === false) {
$output->writeln(sprintf('<error>Install of %s failed!</error>', $module));
} else {
$output->writeln(sprintf('<info>Install of %s completed.</info>', $module));
}
$xoops->cache()->delete('system');
}
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:42,代码来源:InstallModuleCommand.php
示例5: smarty_block_assets
function smarty_block_assets($params, $content, $template, &$repeat)
{
// Opening tag (first call only)
if ($repeat) {
$xoops = \Xoops::getInstance();
$assets = explode(',', $params['assets']);
if (isset($params['filters'])) {
$filters = $params['filters'];
} else {
$filters = 'default';
}
$output = strtolower($params['output']);
$debug = isset($params['debug']) ? (bool) $params['debug'] : false;
if ($debug) {
$xoops->assets()->setDebug($debug);
}
$url = $xoops->assets()->getUrlToAssets($output, $assets, $filters);
if (isset($params['asset_url'])) {
$asset_url = $params['asset_url'];
} else {
$asset_url = 'asset_url';
}
$template->assign($asset_url, $url);
} else {
// Closing tag
if (isset($content)) {
return $content;
}
}
}
开发者ID:RanLee,项目名称:XoopsCore,代码行数:30,代码来源:block.assets.php
示例6: getQRUrl
/**
* getQRUrl
*
* @param string $qrText text for QR code
*
* @return string URL to obtain QR Code image of $qrText
*/
private function getQRUrl($qrText)
{
$xoops = \Xoops::getInstance();
$params = array('text' => (string) $qrText);
$url = $xoops->buildUrl($xoops->url($this->renderScript), $params);
return $url;
}
开发者ID:redmexico,项目名称:XoopsCore,代码行数:14,代码来源:QrcodeProvider.php
示例7: smarty_function_xoInboxCount
function smarty_function_xoInboxCount($params, &$smarty)
{
$xoops = Xoops::getInstance();
if (!$xoops->isUser()) {
return;
}
$time = time();
if (isset($_SESSION['xoops_inbox_count']) && @$_SESSION['xoops_inbox_count_expire'] > $time) {
$count = (int) $_SESSION['xoops_inbox_count'];
} else {
$pm_handler = $xoops->getHandlerPrivateMessage();
$xoopsPreload = XoopsPreload::getInstance();
$xoopsPreload->triggerEvent('core.class.smarty.xoops_plugins.xoinboxcount', array($pm_handler));
$criteria = new CriteriaCompo(new Criteria('read_msg', 0));
$criteria->add(new Criteria('to_userid', $xoops->user->getVar('uid')));
$count = (int) $pm_handler->getCount($criteria);
$_SESSION['xoops_inbox_count'] = $count;
$_SESSION['xoops_inbox_count_expire'] = $time + 60;
}
if (!@empty($params['assign'])) {
$smarty->assign($params['assign'], $count);
} else {
echo $count;
}
}
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:25,代码来源:function.xoInboxCount.php
示例8: search
/**
* search - search
*
* @param string[] $queryArray search terms
* @param string $andor and/or how to treat search terms
* @param integer $limit max number to return
* @param integer $offset offset of first row to return
* @param integer $userid a specific user id to limit the query
*
* @return array of result items
* 'title' => the item title
* 'content' => brief content or summary
* 'link' => link to visit item
* 'time' => time modified (unix timestamp)
* 'uid' => author uid
* 'image' => icon for search display
*
*/
public function search($queryArray, $andor, $limit, $offset, $userid)
{
$andor = strtolower($andor) == 'and' ? 'and' : 'or';
$qb = \Xoops::getInstance()->db()->createXoopsQueryBuilder();
$eb = $qb->expr();
$qb->select('DISTINCT *')->fromPrefix('page_content')->where($eb->neq('content_status', '0'))->orderBy('content_create', 'DESC')->setFirstResult($offset)->setMaxResults($limit);
if (is_array($queryArray) && !empty($queryArray)) {
$queryParts = array();
foreach ($queryArray as $i => $q) {
$qterm = ':qterm' . $i;
$qb->setParameter($qterm, '%' . $q . '%', \PDO::PARAM_STR);
$queryParts[] = $eb->orX($eb->like('content_title', $qterm), $eb->like('content_text', $qterm), $eb->like('content_shorttext', $qterm));
}
if ($andor == 'and') {
$qb->andWhere(call_user_func_array(array($eb, "andX"), $queryParts));
} else {
$qb->andWhere(call_user_func_array(array($eb, "orX"), $queryParts));
}
} else {
$qb->setParameter(':uid', (int) $userid, \PDO::PARAM_INT);
$qb->andWhere($eb->eq('content_author', ':uid'));
}
$myts = MyTextSanitizer::getInstance();
$items = array();
$result = $qb->execute();
while ($myrow = $result->fetch(\PDO::FETCH_ASSOC)) {
$content = $myrow["content_shorttext"] . "<br /><br />" . $myrow["content_text"];
$content = $myts->xoopsCodeDecode($content);
$items[] = array('title' => $myrow['content_title'], 'content' => Metagen::getSearchSummary($content, $queryArray), 'link' => "viewpage.php?id=" . $myrow["content_id"], 'time' => $myrow['content_create'], 'uid' => $myrow['content_author'], 'image' => 'images/logo_small.png');
}
return $items;
}
开发者ID:redmexico,项目名称:XoopsCore,代码行数:50,代码来源:search.php
示例9: getHelper
/**
* @param string $dirname
*
* @return bool|Xoops\Module\Helper\HelperAbstract
*/
public static function getHelper($dirname = 'system')
{
static $modules = array();
$dirname = strtolower($dirname);
if (!isset($modules[$dirname])) {
$modules[$dirname] = false;
$xoops = \Xoops::getInstance();
if ($xoops->isActiveModule($dirname)) {
//Load Module helper if available
if (\XoopsLoad::loadFile($xoops->path("modules/{$dirname}/class/helper.php"))) {
$className = '\\' . ucfirst($dirname);
if (class_exists($className)) {
$class = new $className();
if ($class instanceof \Xoops\Module\Helper\HelperAbstract) {
$modules[$dirname] = $class::getInstance();
}
}
} else {
//Create Module Helper
$xoops->registry()->set('module_helper_id', $dirname);
$class = \Xoops\Module\Helper\Dummy::getInstance();
$class->setDirname($dirname);
$modules[$dirname] = $class;
}
}
}
return $modules[$dirname];
}
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:33,代码来源:Helper.php
示例10: getCounts
/**
* get counts matching a condition
*
* @param CriteriaElement|null $criteria criteria to match
*
* @return array of counts
*/
public function getCounts(CriteriaElement $criteria = null)
{
$qb = \Xoops::getInstance()->db()->createXoopsQueryBuilder();
$ret = array();
$limit = null;
$start = null;
$groupby_key = $this->handler->keyName;
if (isset($criteria) && $criteria instanceof CriteriaElement) {
if ($groupBy = $criteria->getGroupBy()) {
$groupby_key = $groupBy;
}
}
$qb->select($groupby_key)->addSelect('COUNT(*)')->from($this->handler->table, null);
if (isset($criteria) && $criteria instanceof CriteriaElement) {
$qb = $criteria->renderQb($qb);
}
$result = $qb->execute();
if (!$result) {
return $ret;
}
while (list($id, $count) = $result->fetch(\PDO::FETCH_NUM)) {
$ret[$id] = $count;
}
return $ret;
}
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:32,代码来源:Stats.php
示例11: getConnection
/**
* Get a reference to the only instance of database class and connects to DB
*
* if the class has not been instantiated yet, this will also take
* care of that
*
* Doctrine connection function
*
* NOTE: Persistance connection is not included. XOOPS_DB_PCONNECT is ignored.
* allowWebChanges also needs to be addressed
*
* @param array $options driverOptions for Doctrine
*
* @return Connection|null Reference to the only instance of database class
*
* @todo change driver to support other databases and support for port, unix_socket and driver options.
*/
public static function getConnection($options = null)
{
static $instance;
if (!isset($instance)) {
$xoops = \Xoops::getInstance();
$config = new \Doctrine\DBAL\Configuration();
$config->setSQLLogger(new XoopsDebugStack());
$parameters = \XoopsBaseConfig::get('db-parameters');
if (!empty($parameters) && is_array($parameters)) {
$connectionParams = $parameters;
$connectionParams['wrapperClass'] = '\\Xoops\\Core\\Database\\Connection';
} else {
$driver = 'pdo_' . \XoopsBaseConfig::get('db-type');
$connectionParams = array('dbname' => \XoopsBaseConfig::get('db-name'), 'user' => \XoopsBaseConfig::get('db-user'), 'password' => \XoopsBaseConfig::get('db-pass'), 'host' => \XoopsBaseConfig::get('db-host'), 'charset' => \XoopsBaseConfig::get('db-charset'), 'driver' => $driver, 'wrapperClass' => '\\Xoops\\Core\\Database\\Connection');
// Support for other doctrine databases
$xoops_db_port = \XoopsBaseConfig::get('db-port');
if (!empty($xoops_db_port)) {
$connectionParams['port'] = $xoops_db_port;
}
$xoops_db_socket = \XoopsBaseConfig::get('db-socket');
if (!empty($xoops_db_socket)) {
$connectionParams['unix_socket'] = $xoops_db_socket;
}
if (!is_null($options) && is_array($options)) {
$connectionParams['driverOptions'] = $options;
}
}
$instance = \Doctrine\DBAL\DriverManager::getConnection($connectionParams, $config);
}
return $instance;
}
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:48,代码来源:Factory.php
示例12: __construct
/**
* @param array $param array of parameters with these keys:
* 'obj' => ImagesCategory|XoopsObject $obj
* 'target' => textarea id
*/
public function __construct($param)
{
$xoops = Xoops::getInstance();
$groups = $xoops->getUserGroups();
extract($param);
$helper = Xoops\Module\Helper::getHelper('images');
$categories = $helper->getHandlerCategories()->getListByPermission($groups, 'imgcat_read');
parent::__construct('', '', $xoops->getEnv('PHP_SELF'), 'post', false, 'inline');
$select = new Xoops\Form\Select('', 'imgcat_id', $imgcat_id);
$select->addOption(0, _AM_IMAGES_CAT_SELECT);
$select->addOptionArray($categories);
if (isset($target)) {
$select->setExtra("onchange='javascript:window.location.href=\"" . $xoops->getEnv('PHP_SELF') . "?target=" . $target . "&imgcat_id=\" + this.value'");
} else {
$select->setExtra("onchange='javascript:window.location.href=\"" . $xoops->getEnv('PHP_SELF') . "?imgcat_id=\" + this.value'");
}
$this->addElement($select);
if (isset($target)) {
$this->addElement(new Xoops\Form\Hidden('target', $target));
}
$write = $helper->getHandlerCategories()->getListByPermission($groups, 'imgcat_write');
if ($imgcat_id > 0 && array_key_exists($imgcat_id, $write)) {
$this->addElement(new Xoops\Form\Hidden('op', 'upload'));
$button = new Xoops\Form\Button('', 'submit', _IMAGES_ADD, 'submit');
$button->setClass('btn btn-success floatright');
$this->addElement($button);
}
}
开发者ID:redmexico,项目名称:XoopsCore,代码行数:33,代码来源:category_imagemanager.php
示例13: execute
/**
* execute the command
*
* @param InputInterface $input input handler
* @param OutputInterface $output output handler
* @return void
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$xoops = \Xoops::getInstance();
$name = $input->getArgument('name');
$value = $input->getArgument('value');
$configHandler = $xoops->getHandlerConfig();
$sysmodule = $xoops->getModuleByDirname('system');
if (empty($sysmodule)) {
$output->writeln('<error>Module system is not installed!</error>');
return;
}
$mid = $sysmodule->mid();
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('conf_modid', $mid));
$criteria->add(new Criteria('conf_name', $name));
$objArray = $configHandler->getConfigs($criteria);
$configItem = reset($objArray);
if (empty($configItem)) {
$output->writeln(sprintf('<error>Config item %s not found!</error>', $name));
return;
}
$configItem->setConfValueForInput($value);
$result = $configHandler->insertConfig($configItem);
if ($result === false) {
$output->writeln(sprintf('<error>Could not set %s!</error>', $name));
}
$output->writeln(sprintf('Set %s', $name));
}
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:35,代码来源:SetConfigCommand.php
示例14: __construct
/**
* @param null $obj
*/
public function __construct($object = null)
{
$this->object = $object;
$this->config = $object->config;
$xoops = Xoops::getInstance();
parent::__construct('', 'xcaptchaform', $xoops->getEnv('PHP_SELF'), 'post', true, 'horizontal');
$activate = new Xoops\Form\Radio(_AM_XCAPTCHA_ACTIVATE, 'disabled', $this->config['disabled']);
$activate->addOption(1, _AM_XCAPTCHA_ENABLE);
$activate->addOption(0, _AM_XCAPTCHA_DISABLE);
$this->addElement($activate, false);
$plugin_List = new Xoops\Form\Select(_AM_XCAPTCHA_PLUGINS, 'mode', $this->config['mode']);
$plugin_List->addOptionArray($this->object->plugin_List);
$this->addElement($plugin_List, false);
$this->addElement(new Xoops\Form\Text(_AM_XCAPTCHA_NAME, 'name', 50, 50, $this->config['name']), true);
$skipmember = new Xoops\Form\Radio(_AM_XCAPTCHA_SKIPMEMBER, 'skipmember', $this->config['skipmember']);
$skipmember->addOption(1, _AM_XCAPTCHA_ENABLE);
$skipmember->addOption(0, _AM_XCAPTCHA_DISABLE);
$this->addElement($skipmember, false);
$this->addElement(new Xoops\Form\Text(_AM_XCAPTCHA_MAXATTEMPTS, 'maxattempts', 2, 2, $this->config['maxattempts']), true);
$this->addElement(new Xoops\Form\Hidden('type', 'config'));
$buttonTray = new Xoops\Form\ElementTray('', '');
$buttonTray->addElement(new Xoops\Form\Hidden('op', 'save'));
$buttonTray->addElement(new Xoops\Form\Button('', 'submit', XoopsLocale::A_SUBMIT, 'submit'));
$buttonTray->addElement(new Xoops\Form\Button('', 'reset', XoopsLocale::A_RESET, 'reset'));
$buttonCancelSend = new Xoops\Form\Button('', 'cancel', XoopsLocale::A_CANCEL, 'button');
$buttonCancelSend->setExtra("onclick='javascript:history.go(-1);'");
$buttonTray->addElement($buttonCancelSend);
$this->addElement($buttonTray);
}
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:32,代码来源:captcha.php
示例15: __construct
/**
* Constructor
*
* @param string $caption caption
* @param string $name element name
* @param bool $include_anon Include user "anonymous"?
* @param mixed $value Pre-selected value (or array of them).
* For an item with massive members, such as "Registered Users",
* "$value" should be used to store selected temporary users only
* instead of all members of that item
* @param int $size Number or rows. "1" makes a drop-down-list.
* @param bool $multiple Allow multiple selections?
*/
public function __construct($caption, $name, $include_anon = false, $value = null, $size = 1, $multiple = false)
{
$xoops = \Xoops::getInstance();
$limit = 200;
$select_element = new Select('', $name, $value, $size, $multiple);
if ($include_anon) {
$select_element->addOption(0, $xoops->getConfig('anonymous'));
}
$member_handler = $xoops->getHandlerMember();
$user_count = $member_handler->getUserCount();
$value = is_array($value) ? $value : (empty($value) ? array() : array($value));
if ($user_count > $limit && count($value) > 0) {
$criteria = new CriteriaCompo(new Criteria('uid', '(' . implode(',', $value) . ')', 'IN'));
} else {
$criteria = new CriteriaCompo();
$criteria->setLimit($limit);
}
$criteria->setSort('uname');
$criteria->setOrder('ASC');
$users = $member_handler->getUserList($criteria);
$select_element->addOptionArray($users);
if ($user_count <= $limit) {
parent::__construct($caption, "", $name);
$this->addElement($select_element);
return;
}
$js_addusers = "<script type='text/javascript'>\n function addusers(opts){\n var num = opts.substring(0, opts.indexOf(':'));\n opts = opts.substring(opts.indexOf(':')+1, opts.length);\n var sel = xoopsGetElementById('" . $name . "');\n var arr = new Array(num);\n for (var n=0; n < num; n++) {\n var nm = opts.substring(0, opts.indexOf(':'));\n opts = opts.substring(opts.indexOf(':')+1, opts.length);\n var val = opts.substring(0, opts.indexOf(':'));\n opts = opts.substring(opts.indexOf(':')+1, opts.length);\n var txt = opts.substring(0, nm - val.length);\n opts = opts.substring(nm - val.length, opts.length);\n var added = false;\n for (var k = 0; k < sel.options.length; k++) {\n if(sel.options[k].value == val){\n added = true;\n break;\n }\n }\n if (added == false) {\n sel.options[k] = new Option(txt, val);\n sel.options[k].selected = true;\n }\n }\n return true;\n }\n </script>";
$token = $xoops->security()->createToken();
$action_tray = new ElementTray("", " | ");
$action_tray->addElement(new Label('', '<a href="#" onclick="var sel = xoopsGetElementById(\'' . $name . '\');for (var i = sel.options.length-1; i >= 0; i--) {if (!sel.options[i].selected) ' . '{sel.options[i] = null;}}; return false;">' . \XoopsLocale::REMOVE_UNSELECTED_USERS . "</a>"));
$action_tray->addElement(new Label('', '<a href="#" onclick="openWithSelfMain(\'' . \XoopsBaseConfig::get('url') . '/include/findusers.php?target=' . $name . '&multiple=' . $multiple . '&token=' . $token . '\', \'userselect\', 800, 600, null); return false;" >' . \XoopsLocale::SEARCH_USERS . "</a>" . $js_addusers));
parent::__construct($caption, '<br /><br />', $name);
$this->addElement($select_element);
$this->addElement($action_tray);
}
开发者ID:redmexico,项目名称:XoopsCore,代码行数:48,代码来源:SelectUser.php
示例16: getListByPermission
/**
* Get a list of imagesCategories
*
* @param array $groups
* @param string $perm
* @param null $display
* @param null $storetype
*
* @return array Array of {@link ImagesImage} objects
*/
public function getListByPermission($groups = array(), $perm = 'imgcat_read', $display = null, $storetype = null)
{
$xoops = Xoops::getInstance();
$criteria = new CriteriaCompo();
if (is_array($groups) && !empty($groups)) {
$criteriaTray = new CriteriaCompo();
foreach ($groups as $gid) {
$criteriaTray->add(new Criteria('gperm_groupid', $gid), 'OR');
}
$criteria->add($criteriaTray);
if ($perm == 'imgcat_read' || $perm == 'imgcat_write') {
$criteria->add(new Criteria('gperm_name', $perm));
$mid = $xoops->getModuleByDirname('images')->getVar('mid');
$criteria->add(new Criteria('gperm_modid', $mid));
}
}
if (isset($display)) {
$criteria->add(new Criteria('imgcat_display', (int) $display));
}
if (isset($storetype)) {
$criteria->add(new Criteria('imgcat_storetype', $storetype));
}
$categories = $this->getPermittedObjects($criteria, 0, 0, true);
$ret = array();
foreach (array_keys($categories) as $i) {
$ret[$i] = $categories[$i]->getVar('imgcat_name');
}
return $ret;
}
开发者ID:redmexico,项目名称:XoopsCore,代码行数:39,代码来源:category.php
示例17: execute
function execute()
{
$xoops = Xoops::getInstance();
if (!function_exists('mb_strlen')) {
return true;
}
// registered users always pass this plugin
if ($xoops->isUser()) {
return true;
}
$lengths = array(0 => 100, 'message' => 2, 'com_text' => 2, 'excerpt' => 2);
foreach ($_POST as $key => $data) {
// dare to ignore arrays/objects
if (!is_string($data)) {
continue;
}
$check_length = isset($lengths[$key]) ? $lengths[$key] : $lengths[0];
if (strlen($data) > $check_length) {
if (strlen($data) == mb_strlen($data)) {
$this->protector->message .= "No multibyte character was found ({$data})\n";
$this->protector->output_log('Singlebyte SPAM', 0, false, 128);
die('Protector rejects your post, because your post looks like SPAM');
}
}
}
return true;
}
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:27,代码来源:postcommon_post_need_multibyte.php
示例18: smarty_function_xoMemberInfo
function smarty_function_xoMemberInfo($params, &$smarty)
{
$xoops = Xoops::getInstance();
$time = time();
$member_info = $_SESSION['xoops_member_info'];
if (!$xoops->isUser()) {
$member_info['uname'] = $xoops->getConfig('anonymous');
} else {
if (@empty($params['infos'])) {
$params['infos'] = 'uname|name|email|user_avatar|url|user_icq|user_aim|user_yim|user_msnm|posts|user_from|user_occ|user_intrest|bio|user_sig';
}
$infos = explode("|", $params['infos']);
if (!is_array($member_info)) {
$member_info = array();
}
foreach ($infos as $info) {
if (!array_key_exists($info, $member_info) && @$_SESSION['xoops_member_info'][$info . '_expire'] < $time) {
$member_info[$info] = $xoops->user->getVar($info, 'E');
$_SESSION['xoops_member_info'][$info] = $member_info[$info];
$_SESSION['xoops_member_info'][$info . '_expire'] = $time + 60;
}
}
}
if (!@empty($params['assign'])) {
$smarty->assign($params['assign'], $member_info);
}
}
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:27,代码来源:function.xoMemberInfo.php
示例19: xoops_module_update_search
/**
* XXX
*
* @copyright XOOPS Project (http://xoops.org)
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @since 2.6.0
* @author Mage Grégory (AKA Mage)
* @version $Id: $
*/
function xoops_module_update_search(XoopsModule &$module)
{
$xoops = Xoops::getInstance();
// Copy old configs in new configs and delete old configs
$config_handler = $xoops->getHandlerConfig();
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('conf_modid', 0));
$criteria->add(new Criteria('conf_catid', 5));
$configs = $config_handler->getConfigs($criteria);
$confcount = count($configs);
if ($confcount > 0) {
for ($i = 0; $i < $confcount; ++$i) {
$criteria = new CriteriaCompo();
$criteria->add(new Criteria('conf_modid', $module->getVar('mid')));
$criteria->add(new Criteria('conf_name', $configs[$i]->getvar('conf_name')));
$new_configs = $config_handler->getConfigs($criteria);
$new_confcount = count($new_configs);
if ($new_confcount > 0) {
for ($j = 0; $j < $new_confcount; ++$j) {
$obj = $config_handler->getConfig($new_configs[$j]->getvar('conf_id'));
}
$obj->setVar("conf_value", $configs[$i]->getvar('conf_value'));
$config_handler->insertConfig($obj);
$config_handler->deleteConfig($configs[$i]);
}
}
}
return true;
}
开发者ID:RanLee,项目名称:XoopsCore,代码行数:38,代码来源:update.php
示例20: smarty_function_thumbnail
/**
* smarty_function_thumbnail
* @param array $params associative array of parameters
* image => xoops virtual path to image
* w => thumbnail width in pixels
* w => thumbnail height in pixels
* @param object &$smarty smarty context
*
* @return string
*/
function smarty_function_thumbnail($params, &$smarty)
{
$image = isset($params['image']) ? $params['image'] : '';
$w = isset($params['w']) ? $params['w'] : 0;
$h = isset($params['h']) ? $params['h'] : 0;
return \Xoops::getInstance()->service('thumbnail')->getImgUrl($image, $w, $h)->getValue();
}
开发者ID:ming-hai,项目名称:XoopsCore,代码行数:17,代码来源:function.thumbnail.php
注:本文中的Xoops类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论