本文整理汇总了PHP中JCckDatabase类的典型用法代码示例。如果您正苦于以下问题:PHP JCckDatabase类的具体用法?PHP JCckDatabase怎么用?PHP JCckDatabase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JCckDatabase类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: prepareExport
public function prepareExport($id = 0)
{
$config = JFactory::getConfig();
$tmp_path = $config->get('tmp_path');
$tmp_dir = uniqid('cck_');
$path = $tmp_path . '/' . $tmp_dir;
$extension = JCckDatabase::loadObject('SELECT name, type, element, folder FROM #__extensions WHERE extension_id=' . (int) $id);
if (!$extension) {
return;
}
jimport('cck.base.install.export');
$name = $extension->element;
$prefix = CCK_Export::getPrefix($extension->type);
$src = JPATH_SITE . '/plugins/' . $extension->folder . '/' . $extension->element;
$xml = JCckDev::fromXML($src . '/' . $name . '.xml');
$version = isset($xml->version) ? '_' . $xml->version : '';
$filename = $prefix . '_' . $extension->folder . '_' . $name . $version;
$path_zip = $tmp_path . '/' . $filename . '.zip';
if (!$filename) {
return;
}
if ($src && JFolder::exists($src)) {
JFolder::copy($src, $path);
CCK_Export::clean($path);
}
CCK_Export::exportLanguage($src . '/' . $name . '.xml', JPATH_ADMINISTRATOR, $path);
CCK_Export::findFields(array($src . '/tmpl/edit.php', $src . '/tmpl/edit2.php'), $path . '/install');
return CCK_Export::zip($path, $path_zip);
}
开发者ID:codigoaberto,项目名称:SEBLOD,代码行数:29,代码来源:cck.php
示例2: getRow
public static function getRow($id, $content_type = '')
{
if (!$id) {
return NULL;
}
$index = $id . '_' . $content_type;
if (isset(self::$_items[$index])) {
return self::$_items[$index];
}
$row = JTable::getInstance('content');
$row->load($id);
if (!$content_type) {
$content_type = JCckDatabase::loadResult('SELECT cck FROM #__cck_core WHERE storage_location = "joomla_article" AND pk = ' . $row->id);
}
if ($content_type) {
$fields = JCckDatabase::loadObject('SELECT * FROM #__cck_store_form_' . $content_type . ' WHERE id = ' . $row->id);
if (count($fields)) {
foreach ($fields as $k => $v) {
$row->{$k} = $v;
}
}
}
self::$_items[$index] = $row;
return $row;
}
开发者ID:olafzieger,项目名称:joomla3.x-seblod-test,代码行数:25,代码来源:article.php
示例3: processById
public static function processById($id = 0)
{
$processing = JCckDatabase::loadObject('SELECT type, scriptfile FROM #__cck_more_processings WHERE published = 1 AND id = ' . (int) $id);
if (is_object($processing) && is_file(JPATH_SITE . $processing->scriptfile)) {
include_once JPATH_SITE . $processing->scriptfile;
}
}
开发者ID:kenyonjohnston,项目名称:hott_theater,代码行数:7,代码来源:toolbox.php
示例4: getInput
protected function getInput()
{
JPluginHelper::importPlugin('cck_field');
require_once JPATH_PLUGINS . '/cck_field_validation/required/required.php';
$name = 'core_options';
$override = array('rows' => 1);
$storage = (string) $this->element['cck_storage_field_prefix'];
$and = $storage != '' ? ' AND a.storage_field LIKE "' . $storage . '%"' : '';
$fields = JCckDatabase::loadObjectList('SELECT a.title as text, a.name as value FROM #__cck_core_fields AS a' . ' WHERE a.storage = "dev" AND a.id > 500' . $and . ' ORDER BY text');
$fields = is_array($fields) ? array_merge(array(JHtml::_('select.option', '', '- ' . JText::_('COM_CCK_ADD_A_FIELD') . ' -')), $fields) : array();
$html = JHtml::_('select.genericlist', $fields, 'fields_list', 'size="1" class="inputbox select" style="max-width:175px;"', 'value', 'text', '', 'fields_list');
$format = (string) $this->element['js_format'];
$lang = JFactory::getLanguage();
$lang->load('com_cck');
$lang->load('com_cck_default', JPATH_SITE);
if ($format != 'raw') {
JCck::loadjQuery(true, true, true);
}
$force_id = (string) $this->element['id'];
$config = array('asset' => '', 'asset_id' => 0, 'client' => '', 'doTranslation' => 1, 'doValidation' => 2, 'pk' => '');
if ($format == 'raw') {
$config['tmpl'] = 'ajax';
}
$inherit = $force_id != '' ? array('id' => (string) $this->element['id']) : array();
$field = JCckDevField::getObject($name);
if (!$field) {
return;
}
$storage_field = $field->storage_field;
$field->storage_field = $this->name;
$field = JCckDevField::get($field, $this->value, $config, $inherit, $override);
$script = $this->_addScripts((string) $this->element['name'], array('value' => $this->value), $format);
return $field->form . $html . $script;
}
开发者ID:codigoaberto,项目名称:SEBLOD,代码行数:34,代码来源:cckpicker.php
示例5: addSubmenu
public static function addSubmenu($option, $vName)
{
$addons = array();
$items = array();
$uix = JCck::getUIX();
$vName2 = JFactory::getApplication()->input->get('filter_e_type', '');
if (JCck::on()) {
$folder = JText::_('COM_CCK_' . _C0_TEXT . 'S');
if ($uix == 'compact') {
$items = array(array('name' => $folder, 'link' => _C0_LINK, 'active' => $vName == _C0_NAME), array('val' => '2', 'pre' => '', 'key' => 'COM_CCK_'));
} else {
$items = array(array('name' => $folder, 'link' => _C0_LINK, 'active' => $vName == _C0_NAME), array('val' => '2', 'pre' => '- ', 'key' => 'COM_CCK_', 'active' => $vName == _C2_NAME || $vName == _C6_NAME && $vName2 == 'type'), array('val' => '3', 'pre' => '- ', 'key' => ''), array('val' => '4', 'pre' => '- ', 'key' => 'COM_CCK_', 'active' => $vName == _C4_NAME || $vName == _C6_NAME && $vName2 == 'search'), array('val' => '1', 'pre' => '- ', 'key' => '', 'active' => $vName == _C1_NAME || $vName == _C7_NAME), array('val' => '5', 'pre' => '', 'key' => ''));
}
if ($vName == 'cck') {
$addons = JCckDatabase::loadObjectList('SELECT a.title, a.link, b.element FROM #__menu AS a LEFT JOIN #__extensions AS b ON b.extension_id = a.component_id' . ' WHERE a.link LIKE "index.php?option=com_cck\\_%" ORDER BY a.title ASC');
}
} else {
$folder = '<img src="' . JROOT_MEDIA_CCK . '/images/12/icon-12-folders.png" border="0" alt=" " width="12" height="12" />';
if ($uix == 'compact') {
$items = array(array('val' => '2', 'pre' => '', 'key' => 'COM_CCK_'), array('name' => $folder, 'link' => _C0_LINK, 'active' => $vName == _C0_NAME));
} else {
$items = array(array('val' => '2', 'pre' => '', 'key' => 'COM_CCK_'), array('val' => '3', 'pre' => '', 'key' => ''), array('val' => '4', 'pre' => '', 'key' => 'COM_CCK_'), array('val' => '1', 'pre' => '', 'key' => ''), array('name' => $folder, 'link' => _C0_LINK, 'active' => $vName == _C0_NAME), array('val' => '5', 'pre' => '', 'key' => ''));
}
}
self::addSubmenuEntries($option, $vName, $items, $addons);
}
开发者ID:olafzieger,项目名称:joomla3.x-seblod-test,代码行数:26,代码来源:helper_admin.php
示例6: onCCK_Storage_LocationAfterRender
public static function onCCK_Storage_LocationAfterRender(&$buffer, &$data, $uri = array())
{
$app = JFactory::getApplication();
if ($uri['layout']) {
return;
}
if ($uri['view'] == 'featured') {
$data['return_view'] = 'featured';
$tag = '&return=featured';
} else {
$data['return_view'] = '';
$tag = '';
}
$class = JCck::on('3.4') ? ' class="hasTooltip"' : '';
$data['doIntegration'] = false;
$data['multilanguage'] = $data['options']->get('multilanguage', 0);
if ($data['multilanguage']) {
$data['search'] = '#<a' . $class . ' href="(.*)index.php\\?option=com_content&task=article.edit' . $tag . '&id=([0-9]*)" (.*)>#U';
} else {
$data['search'] = '#<a' . $class . ' href="(.*)index.php\\?option=com_content&task=article.edit' . $tag . '&id=([0-9]*)"#';
}
$data['search_alt'] = '#<a href = "javascript://" onclick="listItemTask\\(\'cb([0-9]*)\', \'articles.archive\'\\)">(.*)</a>#sU';
if (JCckDevHelper::hasLanguageAssociations() && $data['multilanguage']) {
$query = 'SELECT a.pk, a.cck, b.key, c.language FROM #__cck_core AS a' . ' LEFT JOIN #__associations AS b ON ( b.id = a.pk AND context = "com_content.item" )' . ' LEFT JOIN #__content AS c ON c.id = a.pk' . ' WHERE storage_location="joomla_article"';
$list_assoc = JCckDatabase::loadObjectListArray('SELECT a.id, a.key, b.language FROM #__associations AS a LEFT JOIN #__content AS b ON ( b.id = a.id AND a.context = "com_content.item" )', 'key', 'language');
} else {
$query = 'SELECT pk, cck FROM #__cck_core WHERE storage_location="joomla_article"';
$list_assoc = array();
}
$list = JCckDatabase::loadObjectList($query, 'pk');
$buffer = JCckDevIntegration::rewriteBuffer($buffer, $data, $list, $list_assoc);
}
开发者ID:codigoaberto,项目名称:SEBLOD,代码行数:32,代码来源:integration.php
示例7: g_onCCK_PaymentValidate
public static function g_onCCK_PaymentValidate($data, $success, &$config)
{
$update = 'pay_return = "' . JCckDatabase::escape(json_encode($data['order'])) . '",' . 'pay_return_payments = "' . JCckDatabase::escape(json_encode($data['payments'])) . '",' . 'state = ' . $data['order_state'];
JCckDatabase::execute('UPDATE #__cck_more_ecommerce_orders SET ' . $update . ' WHERE pay_key = "' . $config['pay_key'] . '"');
if (!$success) {
return;
}
// Cart
$cart_id = (int) JCckDatabase::loadResult('SELECT a.id FROM #__cck_more_ecommerce_carts AS a WHERE a.pay_key = "' . $config['pay_key'] . '"');
if ($cart_id) {
JCckDatabase::execute('UPDATE #__cck_more_ecommerce_carts SET pay_key = "" WHERE id = ' . $cart_id);
JCckDatabase::execute('DELETE a.* FROM #__cck_more_ecommerce_cart_product AS a WHERE a.cart_id = ' . $cart_id);
}
// Execute Processings (Invoice, Notifications, ...)
if (JCckToolbox::getConfig()->get('processing', 0)) {
$event = 'onCckPaymentSuccess';
$processing = JCckDatabaseCache::loadObjectListArray('SELECT type, scriptfile, options FROM #__cck_more_processings WHERE published = 1 ORDER BY ordering', 'type');
if (isset($processing[$event])) {
foreach ($processing[$event] as $p) {
if (is_file(JPATH_SITE . $p->scriptfile)) {
$options = new JRegistry($p->options);
include_once JPATH_SITE . $p->scriptfile;
}
}
}
}
}
开发者ID:codigoaberto,项目名称:SEBLOD,代码行数:27,代码来源:payment.php
示例8: prepareSidebar
protected function prepareSidebar()
{
if (!JCck::on()) {
return;
}
$buttons = array();
if (JCck::getUIX() == 'compact') {
$core = array(array('val' => '2', 'pre' => '', 'key' => 'COM_CCK_'));
} else {
$core = array(array('val' => '0', 'pre' => '', 'key' => 'COM_CCK_', 'img' => 'cck-application'), array('val' => '2', 'pre' => '- ', 'key' => 'COM_CCK_', 'img' => 'cck-form'), array('val' => '3', 'pre' => '- ', 'key' => '', 'img' => 'cck-plugin'), array('val' => '4', 'pre' => '- ', 'key' => 'COM_CCK_', 'img' => 'cck-search'), array('val' => '1', 'pre' => '- ', 'key' => '', 'img' => 'cck-template'), array('val' => '5', 'pre' => '', 'key' => '', 'img' => 'cck-multisite'));
}
$components = JCckDatabase::loadObjectList('SELECT a.title, a.link, b.element' . ' FROM #__menu AS a LEFT JOIN #__extensions AS b ON b.extension_id = a.component_id' . ' WHERE a.link LIKE "index.php?option=com_cck\\_%"' . ' AND a.link NOT IN ("index.php?option=com_cck_toolbox&view=processing","index.php?option=com_cck_webservices&view=api")' . ' ORDER BY a.title ASC');
$groupedButtons = array();
$more = array('ADDON' => 16, 'PLUGIN_FIELD' => 19, 'PLUGIN_LINK' => 20, 'PLUGIN_LIVE' => 21, 'PLUGIN_RESTRICTION' => 112, 'PLUGIN_TYPOGRAPHY' => 24, 'PLUGIN_VALIDATION' => 25, 'TEMPLATE' => 27);
foreach ($core as $k => $v) {
$buttons[] = array('access' => array('core.manage', 'com_cck'), 'group' => 'COM_CCK_CORE', 'image' => $v['img'], 'link' => JRoute::_(constant('_C' . $v['val'] . '_LINK')), 'target' => '_self', 'text' => $v['pre'] . JText::_($v['key'] . constant('_C' . $v['val'] . '_TEXT') . 'S'));
}
foreach ($components as $k => $v) {
$buttons[] = array('access' => array('core.manage', $v->element), 'group' => 'COM_CCK_SEBLOD_MORE', 'image' => 'cck-addon', 'link' => JRoute::_($v->link), 'target' => '_self', 'text' => $v->title);
}
foreach ($more as $k => $v) {
$buttons[] = array('access' => array('core.manage', 'com_cck'), 'group' => 'COM_CCK_SEBLOD_COM', 'image' => 'download', 'link' => JRoute::_('http://www.seblod.com/products?seb_item_category=' . $v), 'target' => '_blank', 'text' => JText::_('COM_CCK_PANE_MORE_' . $k));
}
foreach ($buttons as $button) {
$groupedButtons[$button['group']][] = $button;
}
$this->sidebar = '<div class="sidebar-nav quick-icons">' . JHtml::_('links.linksgroups', $groupedButtons) . '</div>';
}
开发者ID:kolydart,项目名称:SEBLOD,代码行数:28,代码来源:view.html.php
示例9: save
public function save($key = null, $urlVar = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$app = JFactory::getApplication();
$model = $this->getModel('form');
$preconfig = $app->input->post->get('config', array(), 'array');
$task = $this->getTask();
$config = $model->store($preconfig);
$id = $config['pk'];
if ($config['validate'] == 'retry') {
parent::display();
return true;
}
if ($id) {
if ($config['stage'] > -1) {
$link = 'index.php?option=' . CCK_COM . '&view=form&type=' . $preconfig['type'] . '&id=' . $id . $this->_getRedirectQuery();
if ($config['stage'] > 0) {
$link .= '&stage=' . $config['stage'];
}
$this->setRedirect(htmlspecialchars_decode($link));
return;
}
if ($config['message_style']) {
if (isset($config['message'])) {
$msg = $config['doTranslation'] ? JText::_('COM_CCK_' . str_replace(' ', '_', trim($config['message']))) : $config['message'];
} else {
$msg = JText::_('COM_CCK_SUCCESSFULLY_SAVED');
}
$msgType = $config['message_style'];
} else {
$msg = '';
$msgType = '';
}
} else {
$msg = JText::_('JERROR_AN_ERROR_HAS_OCCURRED');
$msgType = 'error';
}
switch ($task) {
case 'apply':
$link = 'index.php?option=' . CCK_COM . '&view=form&type=' . $preconfig['type'] . '&id=' . $id . $this->_getRedirectQuery();
break;
case 'save2new':
$link = 'index.php?option=' . CCK_COM . '&view=form&type=' . $preconfig['type'] . $this->_getRedirectQuery();
break;
case 'save2view':
$location = JCckDatabase::loadResult('SELECT storage_location FROM #__cck_core WHERE id = ' . (int) $id);
$sef = 0;
$itemId2 = 0;
if ($location) {
require_once JPATH_SITE . '/plugins/cck_storage_location/' . $location . '/' . $location . '.php';
$link = JCck::callFunc_Array('plgCCK_Storage_Location' . $location, 'getRoute', array($config['pk'], $sef, $itemId2, array('type' => $config['type'])));
$link = str_replace('/administrator/', '/', $link);
break;
}
default:
$link = $this->_getRedirectQuery(true);
break;
}
$this->setRedirect(htmlspecialchars_decode($link), $msg, $msgType);
}
开发者ID:densem-2013,项目名称:exikom,代码行数:60,代码来源:form.php
示例10: _delete
protected function _delete($pk, $location, $base)
{
$id = JCckDatabase::loadResult('SELECT id FROM #__cck_core WHERE storage_location = "' . (string) $location . '" AND pk = ' . (int) $pk);
if (!$id) {
return true;
}
$table = JCckTable::getInstance('#__cck_core', 'id', $id);
$type = $table->cck;
$pkb = (int) $table->pkb;
$table->delete();
if ($pkb > 0) {
$table = JTable::getInstance('content');
$table->delete($pkb);
}
$tables = JCckDatabase::loadColumn('SHOW TABLES');
$prefix = JFactory::getConfig()->get('dbprefix');
if (in_array($prefix . 'cck_store_item_' . $base, $tables)) {
$table = JCckTable::getInstance('#__cck_store_item_' . $base, 'id', $pk);
if ($table->id) {
$table->delete();
}
}
if (in_array($prefix . 'cck_store_form_' . $type, $tables)) {
$table = JCckTable::getInstance('#__cck_store_form_' . $type, 'id', $pk);
if ($table->id) {
$table->delete();
}
}
}
开发者ID:hamby,项目名称:SEBLOD,代码行数:29,代码来源:cck.php
示例11: getGateway
public static function getGateway()
{
$user = JFactory::getUser();
$access = implode(',', $user->getAuthorisedViewLevels());
$name = JCckDatabase::loadResult('SELECT type' . ' FROM #__cck_more_ecommerce_gateways' . ' WHERE published = 1 AND access IN (' . $access . ')' . ' ORDER BY id DESC');
return $name;
}
开发者ID:hamby,项目名称:SEBLOD,代码行数:7,代码来源:payment.php
示例12: getCall
public static function getCall($name)
{
static $cache = array();
if (!isset($cache[$name])) {
$cache[$name] = JCckDatabase::loadObject('SELECT b.name, b.type, b.options, a.request, a.request_object, a.request_options, a.response' . 'FROM #__cck_more_webservices_calls AS a' . ' LEFT JOIN #__cck_more_webservices AS b ON b.id = a.webservice' . ' WHERE a.name = "' . $name . '"');
}
return $cache[$name];
}
开发者ID:olafzieger,项目名称:joomla3.x-seblod-test,代码行数:8,代码来源:webservice.php
示例13: onCCK_FieldExportField
public static function onCCK_FieldExportField(&$field, &$data, &$extensions)
{
$field->options = self::_exportCategories($field->options, '||', $data);
$name = $field->storage_field2 != '' ? $field->storage_field2 : $field->storage_field;
$sql_table = '#__cck_store_join_' . $name;
$sql_path = $data['root_sql'] . '/' . $sql_table . '.sql';
$sql_buffer = JCckDatabase::getTableCreate(array($sql_table));
JFile::write($sql_path, $sql_buffer);
}
开发者ID:codigoaberto,项目名称:SEBLOD,代码行数:9,代码来源:app.php
示例14: getTargets
public static function getTargets($id)
{
static $cache = array();
if (!isset($cache[$id])) {
$cache[$id] = JCckDatabase::loadColumn('SELECT product_id FROM #__cck_more_ecommerce_promotion_product WHERE promotion_id = ' . (int) $id);
$cache[$id] = array_flip($cache[$id]);
}
return $cache[$id];
}
开发者ID:densem-2013,项目名称:exikom,代码行数:9,代码来源:promotion.php
示例15: countItems
public static function countItems($store_id, $object = 'joomla_article')
{
$cache = array();
$count = 0;
$user = JFactory::getUser();
if (!isset($cache[$store_id])) {
$cache[$store_id] = JCckDatabase::loadResult('SELECT COUNT(a.id) FROM #__cck_core AS a' . ' LEFT JOIN #__content AS b ON (b.id = a.pk AND a.storage_location = "joomla_article")' . ' WHERE a.store_id = ' . $store_id . ' AND b.state = 1');
}
return $cache[$store_id];
}
开发者ID:densem-2013,项目名称:exikom,代码行数:10,代码来源:store.php
示例16: countItems
public static function countItems($definition)
{
static $cache = array();
$count = 0;
$user = JCck::getUser();
if (!isset($cache[$definition])) {
$cache[$definition] = JCckDatabase::loadResult('SELECT COUNT(a.id) FROM #__cck_more_ecommerce_cart_product AS a' . ' LEFT JOIN #__cck_more_ecommerce_carts AS b ON b.id = a.cart_id WHERE b.type = "' . $definition . '" AND b.' . (string) $user->where_clause . ' AND b.state = 1');
}
return $cache[$definition];
}
开发者ID:densem-2013,项目名称:exikom,代码行数:10,代码来源:cart.php
示例17: authorise
public static function authorise(&$field, &$config)
{
$user = JCck::getUser();
$check = JCckDatabase::loadResult('SELECT COUNT(a.id) FROM #__cck_more_ecommerce_order_product AS a LEFT JOIN #__cck_more_ecommerce_orders AS b ON b.id = a.order_id' . ' WHERE a.product_id = ' . $config['pk'] . ' AND b.user_id =' . $user->id);
if ((int) $check > 0) {
//
} else {
$field->display = 0;
}
}
开发者ID:codigoaberto,项目名称:SEBLOD,代码行数:10,代码来源:restriction.php
示例18: _setMultisite
public static function _setMultisite()
{
if ((int) self::getConfig_Param('multisite', 0)) {
self::$_host = JURI::getInstance()->getHost();
self::$_sites = JCckDatabase::loadObjectList('SELECT id, title, name, guest, guest_only_viewlevel, groups, viewlevels, configuration, options FROM #__cck_core_sites WHERE published = 1', 'name');
return true;
} else {
return false;
}
}
开发者ID:pctechnikch,项目名称:SEBLOD,代码行数:10,代码来源:cck.php
示例19: getItems
public function getItems()
{
jimport('joomla.filesystem.folder');
$folders = JFolder::folders(JPATH_LIBRARIES . '/cck/rendering/variations');
$i = 0;
$items = array();
$variations = array('empty' => '', 'joomla' => '', 'seb_css3' => '', 'seb_css3b' => '');
// Filter Search
$location = $this->getState('filter.location');
$search = $this->getState('filter.search');
// Library
if (count($folders) && $location != 'template_name') {
foreach ($folders as $k => $v) {
if ($search && strpos($v, $search) === false) {
continue;
}
$items[$i] = new stdClass();
$items[$i]->folder = '/libraries/cck/rendering/variations/';
$items[$i]->template = '';
$items[$i]->title = $v;
$items[$i]->type = isset($variations[$v]) ? 0 : 1;
$items[$i++]->id = $i;
}
}
// Templates
if ($search && $location == 'template_name') {
$templates = array(0 => $search);
$search = '';
} else {
$templates = JCckDatabase::loadColumn('SELECT name FROM #__cck_core_templates');
}
if (count($templates)) {
foreach ($templates as $k => $template) {
$path = '/templates/' . $template . '/variations';
if (JFolder::exists(JPATH_SITE . $path)) {
$folders = JFolder::folders(JPATH_SITE . $path);
if (count($folders)) {
foreach ($folders as $k => $v) {
if ($search && strpos($v, $search) === false) {
continue;
}
$items[$i] = new stdClass();
$items[$i]->folder = $path;
$items[$i]->template = $template;
$items[$i]->title = $v;
$items[$i]->type = 1;
$items[$i++]->id = $i;
}
}
}
}
}
return $items;
}
开发者ID:hamby,项目名称:SEBLOD,代码行数:54,代码来源:variations.php
示例20: uniqid
public static function &getUser($userid = 0, $content_type = '', $profile = true)
{
if (!$userid) {
$user = JFactory::getUser();
} else {
$user = JFactory::getUser($userid);
}
// Core
if ($user->id && $user->guest != 1) {
$user->session_id = null;
$user->where_clause = 'user_id=' . $user->id;
} else {
$user->session_id = JFactory::getSession()->getId();
if (empty($user->session_id)) {
$user->session_id = uniqid();
/* Not good, but better than empty */
}
$user->where_clause = 'session_id="' . $user->session_id . '"';
}
// IP
$user->ip = getenv('REMOTE_ADDR');
// $_SERVER["REMOTE_ADDR"];
// More
if ($user->id && $profile) {
if (!$content_type) {
$content_type = '';
// todo: config
if (!$content_type) {
$content_type = JCckDatabase::loadResult('SELECT cck FROM #__cck_core WHERE storage_location = "joomla_user" AND pk = ' . (int) $user->id);
}
}
$db = JFactory::getDbo();
$prefix = $db->getPrefix();
$tables = $db->getTableList();
$tables = array_flip($tables);
if (isset($tables[$prefix . 'cck_store_item_users'])) {
$fields = JCckDatabase::loadObject('SELECT * FROM #__cck_store_item_users WHERE id = ' . (int) $user->id);
if (count($fields)) {
foreach ($fields as $k => $v) {
$user->{$k} = $v;
}
}
}
if (isset($tables[$prefix . 'cck_store_form_' . $content_type])) {
$fields = JCckDatabase::loadObject('SELECT * FROM #__cck_store_form_' . $content_type . ' WHERE id = ' . (int) $user->id);
if (count($fields)) {
foreach ($fields as $k => $v) {
$user->{$k} = $v;
}
}
}
}
return $user;
}
开发者ID:hamby,项目名称:SEBLOD,代码行数:54,代码来源:user.php
注:本文中的JCckDatabase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论