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


PHP XoopsDatabaseFactory类代码示例

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


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

示例1: pwSearch

/**
* @desc Realiza una búsqueda en el módulo desde EXM
*/
function pwSearch($queryarray, $andor, $limit, $offset, $userid)
{
    global $myts;
    include_once XOOPS_ROOT_PATH . "/modules/works/class/pwwork.class.php";
    $mc = RMUtilities::module_config('works');
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT a.* FROM " . $db->prefix('pw_works') . " a INNER JOIN " . $db->prefix('pw_clients') . " b ON (a.public=1 AND a.client=b.id_client AND (";
    $sql1 = '';
    if (is_array($queryarray)) {
        foreach ($queryarray as $k) {
            $sql1 .= ($sql1 == '' ? "" : "{$andor}") . " (a.title LIKE '%{$k}%' OR a.short LIKE '%{$k}%' OR b.name LIKE '%{$k}%' OR b.business_name LIKE '%{$k}%') ";
        }
    }
    $sql1 .= "))";
    $sql1 .= " GROUP BY a.id_work ORDER BY a.created DESC LIMIT {$offset}, {$limit}";
    $result = $db->queryF($sql . $sql1);
    $ret = array();
    while ($row = $db->fetchArray($result)) {
        $work = new PWWork();
        $work->assignVars($row);
        $rtn = array();
        $rtn['image'] = 'images/works.png';
        $rtn['title'] = $work->title();
        $rtn['time'] = $work->created();
        $rtn['uid'] = '';
        $rtn['desc'] = $work->descShort();
        $rtn['link'] = $work->link();
        $ret[] = $rtn;
    }
    return $ret;
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:34,代码来源:search.php

示例2: pw_comments_show

function pw_comments_show($options)
{
    global $xoopsModule, $xoopsModuleConfig;
    include_once XOOPS_ROOT_PATH . '/modules/works/class/pwwork.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/works/class/pwclient.class.php';
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    if (isset($xoopsModule) && $xoopsModule->dirname() == 'works') {
        $mc =& $xoopsModuleConfig;
    } else {
        $mc =& RMUtilities::module_config('works');
    }
    $sql = "SELECT * FROM " . $db->prefix('pw_works') . " WHERE comment<>'' ORDER BY " . ($options[1] ? " created DESC " : " RAND() ");
    $sql .= " LIMIT 0," . $options[0];
    $result = $db->query($sql);
    $clients = array();
    while ($row = $db->fetchArray($result)) {
        $work = new PWWork();
        $work->assignVars($row);
        if (!isset($clients[$work->client()])) {
            $clients[$work->client()] = new PWClient($work->client(), 1);
        }
        $client =& $clients[$work->client()];
        $rtn = array();
        $rtn['client'] = $client->businessName();
        $rtn['link'] = $work->link();
        $rtn['comment'] = $work->comment();
        $block['works'][] = $rtn;
    }
    return $block;
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:30,代码来源:pw_comments.php

示例3: dt_com_update

/**
* @desc Función para incrementar el número de comentarios
*/
function dt_com_update($item, $total)
{
    include_once XOOPS_ROOT_PATH . '/modules/dtransport/class/dtsoftware.class.php';
    $db =& XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "UPDATE " . $db->prefix("dtrans_software") . " SET comments='{$total}' WHERE id_soft='{$item}'";
    $db->queryF($sql);
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:10,代码来源:comment.func.php

示例4: __construct

 public function __construct($id = null, $col = 0)
 {
     $this->db = XoopsDatabaseFactory::getDatabaseConnection();
     $this->_dbtable = $this->db->prefix("gs_users");
     $this->setNew();
     $this->initVarsFromTable();
     if ($col) {
         $this->primary = 'uid';
     }
     if (!isset($id)) {
         return;
     }
     if (is_numeric($id)) {
         if (!$this->loadValues($id)) {
             return;
         }
         $this->unsetNew();
     } else {
         $this->primary = 'uname';
         if ($this->loadValues($id)) {
             $this->unsetNew();
         }
         $this->primary = 'id_user';
     }
     $this->eUser = new XoopsUser($this->getVar('uid'));
     $this->primary = 'id_user';
 }
开发者ID:laiello,项目名称:bitcero-modules,代码行数:27,代码来源:gsuser.class.php

示例5: plugin_settings

 /**
  * Retrieves the settings for a given plugin
  *
  * @param string $dir Plugin's directory
  * @param bool $values
  * @return array
  */
 static function plugin_settings($dir, $values = false)
 {
     if ($dir == '') {
         return null;
     }
     if (!isset(self::$plugin_settings[$dir])) {
         $db = XoopsDatabaseFactory::getDatabaseConnection();
         $sql = "SELECT * FROM " . $db->prefix("mod_rmcommon_settings") . " WHERE element='{$dir}'";
         $result = $db->query($sql);
         if ($db->getRowsNum($result) <= 0) {
             return null;
         }
         $configs = array();
         while ($row = $db->fetchArray($result)) {
             $configs[$row['name']] = $row;
         }
         $configs = self::option_value_output($configs);
         self::$plugin_settings[$dir] = $configs;
     }
     if (!$values) {
         return (object) self::$plugin_settings[$dir];
     }
     $ret = array();
     foreach (self::$plugin_settings[$dir] as $name => $conf) {
         $ret[$name] = $conf['value'];
     }
     return (object) $ret;
 }
开发者ID:txmodxoops,项目名称:rmcommon,代码行数:35,代码来源:settings.class.php

示例6: xoops_module_update_rmcommon

function xoops_module_update_rmcommon($mod, $prev)
{
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    // Add tables to database
    $sql = "ALTER TABLE `" . $db->prefix("rmc_blocks") . "` ADD `content` TEXT NOT NULL AFTER `content_type`";
    return $db->queryF($sql);
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:7,代码来源:install.php

示例7: foreach

function &gs_rssshow($limit)
{
    global $util, $mc;
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsimage.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsset.class.php';
    include_once XOOPS_ROOT_PATH . '/modules/galleries/class/gsuser.class.php';
    foreach ($_GET as $k => $v) {
        ${$k} = $v;
    }
    $feed = array();
    // Información General
    $items = array();
    $mc =& $util->moduleConfig('galleries');
    if ($show == 'imgs') {
        $feed['title'] = htmlspecialchars(_MI_GS_RSSNAME);
        $feed['link'] = htmlspecialchars(XOOPS_URL . '/modules/galleries/' . ($mc['urlmode'] ? 'explore/photos/' : 'explore.php?by=explore/photos'));
        $feed['description'] = htmlspecialchars(_MI_GS_RSSIMGS_DESC);
        $sql = "SELECT * FROM " . $db->prefix("gs_images") . " WHERE public='2' ORDER BY created DESC LIMIT 0,15";
        $result = $db->query($sql);
        $users = array();
        while ($row = $db->fetchArray($result)) {
            $pic = new GSImage();
            $pic->assignVars($row);
            if (!isset($users[$pic->owner()])) {
                $users[$pic->owner()] = new GSUser($pic->owner(), 1);
            }
            $user =& $users[$pic->owner()];
            $rtn = array();
            $rtn['title'] = htmlspecialchars($pic->title());
            $rtn['link'] = $user->userURL() . 'img/' . $pic->id() . '/';
            $rtn['description'] = htmlspecialchars('<img src="' . $user->filesURL() . '/ths/' . $pic->image() . '" alt="" /><br />' . sprintf(_MI_GS_RSSIMGDESC, $pic->desc(), formatTimestamp($pic->created(), 'string'), $user->uname(), $pic->views()));
            $rtn['date'] = formatTimestamp($pic->created());
            $items[] = $rtn;
        }
    } elseif ($show == 'sets') {
        $feed['title'] = htmlspecialchars(_MI_GS_RSSSETS);
        $feed['link'] = htmlspecialchars(XOOPS_URL . '/modules/galleries/' . ($mc['urlmode'] ? 'explore/sets/' : 'explore.php?by=explore/sets'));
        $feed['description'] = htmlspecialchars(_MI_GS_RSSSETS_DESC);
        $sql = "SELECT * FROM " . $db->prefix("gs_sets") . " WHERE public='2' ORDER BY date DESC LIMIT 0,15";
        $result = $db->query($sql);
        $users = array();
        while ($row = $db->fetchArray($result)) {
            $set = new GSSet();
            $set->assignVars($row);
            if (!isset($users[$set->owner()])) {
                $users[$set->owner()] = new GSUser($set->owner(), 1);
            }
            $user =& $users[$set->owner()];
            $rtn = array();
            $rtn['title'] = htmlspecialchars($set->title());
            $rtn['link'] = $user->userURL() . 'set/' . $set->id() . '/';
            $rtn['description'] = htmlspecialchars(sprintf(_MI_GS_RSSSETDESC, $user->uname(), formatTimestamp($set->date(), 'string'), $set->pics()));
            $rtn['date'] = formatTimestamp($set->date());
            $items[] = $rtn;
        }
    }
    $ret = array('feed' => $feed, 'items' => $items);
    return $ret;
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:60,代码来源:rss.php

示例8: qpages_search

/**
 * Función para realizar búsquedas
 */
function qpages_search($qa, $andor, $limit, $offset, $userid)
{
    global $xoopsUser, $mc;
    include_once XOOPS_ROOT_PATH . '/modules/qpages/class/qppage.class.php';
    $mc = RMUtilities::module_config('qpages');
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $sql = "SELECT * FROM " . $db->prefix("qpages_pages");
    $adds = '';
    if (is_array($qa) && ($count = count($qa))) {
        $adds = '';
        for ($i = 0; $i < $count; $i++) {
            $adds .= $adds == '' ? "(titulo LIKE '%{$qa[$i]}%' OR titulo_amigo LIKE '%{$qa[$i]}%')" : " {$andor} (titulo LIKE '%{$qa[$i]}%' OR titulo_amigo LIKE '%{$qa[$i]}%')";
        }
    }
    $sql .= $adds != '' ? " WHERE {$adds}" : '';
    if ($userid > 0) {
        $sql .= ($adds != '' ? " AND " : " WHERE ") . "uid='{$userid}'";
    }
    $sql .= " ORDER BY modificado DESC";
    $i = 0;
    $result = $db->query($sql);
    $ret = array();
    while ($row = $db->fetchArray($result)) {
        $page = new QPPage();
        $page->assignVars($row);
        $ret[$i]['image'] = "images/page.png";
        $ret[$i]['link'] = $mc['links'] == 0 ? 'page.php?page=' . $page->getFriendTitle() : $page->getFriendTitle() . '/';
        $ret[$i]['title'] = $page->getTitle();
        $ret[$i]['time'] = $page->getDate();
        $ret[$i]['uid'] = $page->uid();
        $ret[$i]['desc'] = $page->getDescription();
        $i++;
    }
    return $ret;
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:38,代码来源:search.func.php

示例9: qpagesBlockPages

/**
 * Mostramos las página existentes
 */
function qpagesBlockPages($options)
{
    global $xoopsConfig;
    include_once XOOPS_ROOT_PATH . '/modules/qpages/class/qppage.class.php';
    $db =& XoopsDatabaseFactory::getDatabaseConnection();
    $mc =& RMUtilities::module_config('qpages');
    if (!defined('QP_URL')) {
        define('QP_URL', XOOPS_URL . ($mc['links'] ? $mc['basepath'] : '/modules/qpages'));
    }
    $sql = "SELECT * FROM " . $db->prefix("qpages_pages");
    if ($options[0] > 0) {
        $sql .= " WHERE cat='{$options['0']}'";
    }
    $sql .= " ORDER BY fecha DESC LIMIT 0,{$options['1']}";
    $block = array();
    $result = $db->query($sql);
    while ($row = $db->fetchArray($result)) {
        $page = new QPPage();
        $page->assignVars($row);
        $rtn = array();
        $rtn['id'] = $page->getID();
        $rtn['titulo'] = $page->getTitle();
        $rtn['link'] = $page->getPermaLink();
        $block['pages'][] = $rtn;
    }
    return $block;
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:30,代码来源:qpages_blocks.php

示例10: __construct

 /**
  * Constructor
  *
  */
 public function __construct()
 {
     Language::load('xmf');
     $this->db = \XoopsDatabaseFactory::getDatabaseConnection();
     $this->databaseName = XOOPS_DB_NAME;
     $this->resetQueue();
 }
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:11,代码来源:Tables.php

示例11: __construct

 function __construct($id = null)
 {
     $this->db = XoopsDatabaseFactory::getDatabaseConnection();
     $this->_dbtable = $this->db->prefix("gs_postcards");
     $this->setNew();
     $this->initVarsFromTable();
     if ($id == null) {
         return;
     }
     /*   if (!$this->loadValues(intval($id))) return;
             
             $this->unsetNew();
     	}*/
     if (is_numeric($id)) {
         if (!$this->loadValues($id)) {
             return;
         }
     } else {
         $this->primary = 'code';
         if ($this->loadValues($id)) {
             $this->unsetNew();
         }
         $this->primary = 'id_post';
         return;
     }
     $this->unsetNew();
 }
开发者ID:laiello,项目名称:bitcero-modules,代码行数:27,代码来源:gspostcard.class.php

示例12: __construct

 function __construct($id = null, $res = 0)
 {
     $this->db =& XoopsDatabaseFactory::getDatabaseConnection();
     $this->_dbtable = $this->db->prefix("rd_sections");
     $this->setNew();
     $this->initVarsFromTable();
     if ($id == null) {
         return;
     }
     if (is_numeric($id)) {
         if (!$this->loadValues($id)) {
             return;
         }
         $this->unsetNew();
     } else {
         $sql = "SELECT * FROM " . $this->_dbtable . " WHERE nameid='{$id}' AND id_res='{$res}'";
         $result = $this->db->query($sql);
         if ($this->db->getRowsNum($result) <= 0) {
             return;
         }
         $row = $this->db->fetchArray($result);
         $this->assignVars($row);
         $this->unsetNew();
     }
 }
开发者ID:laiello,项目名称:bitcero-modules,代码行数:25,代码来源:rdsection.class.php

示例13: rd_block_resources

/**
* Este archivo permite controlar el bloque o los bloques
* Bloques Existentes:
* 
* 1. Publicaciones Recientes
* 2. Publicaciones Populares (Mas Leídas)
* 3. Publicaciones Mejor Votadas
*/
function rd_block_resources($options)
{
    global $xoopsModule;
    include_once XOOPS_ROOT_PATH . '/modules/docs/class/rdresource.class.php';
    $db = XoopsDatabaseFactory::getDatabaseConnection();
    $mc = RMUtilities::module_config('docs');
    $sql = "SELECT * FROM " . $db->prefix("rd_resources") . ' WHERE public=1 AND approved=1';
    switch ($options[0]) {
        case 'recents':
            $sql .= " ORDER BY created DESC";
            break;
        case 'popular':
            $sql .= " ORDER BY `reads` DESC";
            break;
    }
    $sql .= " LIMIT 0, " . ($options[1] > 0 ? $options[1] : 5);
    $result = $db->query($sql);
    $block = array();
    while ($row = $db->fetchArray($result)) {
        $res = new RDResource();
        $res->assignVars($row);
        $ret = array();
        $ret['id'] = $res->id();
        $ret['title'] = $res->getVar('title');
        if ($options[2]) {
            $ret['desc'] = $options[3] == 0 ? $res->getVar('description') : TextCleaner::truncate($res->getVar('description'), $options[3]);
        }
        $ret['link'] = $res->permalink();
        $ret['author'] = sprintf(__('Created by %s', 'docs'), '<strong>' . $res->getVar('owname') . '</strong>');
        $ret['reads'] = sprintf(__('Viewed %s times', 'docs'), '<strong>' . $res->getVar('reads') . '</strong>');
        $block['resources'][] = $ret;
    }
    RMTemplate::get()->add_style('blocks.css', 'docs');
    return $block;
}
开发者ID:laiello,项目名称:bitcero-modules,代码行数:43,代码来源:rd_resources.php

示例14: __construct

 public function __construct($id = null)
 {
     $this->db = XoopsDatabaseFactory::getDatabaseConnection();
     $this->_dbtable = $this->db->prefix("bxpress_posts");
     $this->setNew();
     $this->initVarsFromTable();
     $this->initVar('post_text', XOBJ_DTYPE_TXTAREA);
     $this->initVar('post_edit', XOBJ_DTYPE_TXTAREA);
     if (!isset($id)) {
         return;
     }
     if (!$this->loadValues($id)) {
         return;
     }
     $this->unsetNew();
     // Cargamos el texto
     $sql = "SELECT * FROM " . $this->db->prefix("bxpress_posts_text") . " WHERE post_id='" . $this->id() . "'";
     $result = $this->db->queryF($sql);
     if ($this->db->getRowsNum($result) <= 0) {
         return;
     }
     $this->havetext = true;
     $row = $this->db->fetchArray($result);
     $this->setVar('post_text', $row['post_text']);
     $this->setVar('post_edit', $row['post_edit']);
 }
开发者ID:laiello,项目名称:bitcero-modules,代码行数:26,代码来源:bxpost.class.php

示例15: __construct

 /**
  * @param      $ctable
  * @param null|array $id
  */
 public function __construct($ctable, $id = null)
 {
     $this->ctable = $ctable;
     $this->db = XoopsDatabaseFactory::getDatabaseConnection();
     parent::__construct();
     $this->initVar('comment_id', XOBJ_DTYPE_INT, null, false);
     $this->initVar('item_id', XOBJ_DTYPE_INT, null, false);
     $this->initVar('order', XOBJ_DTYPE_INT, null, false);
     $this->initVar('mode', XOBJ_DTYPE_OTHER, null, false);
     $this->initVar('subject', XOBJ_DTYPE_TXTBOX, null, false, 255);
     $this->initVar('comment', XOBJ_DTYPE_TXTAREA, null, false, null);
     $this->initVar('ip', XOBJ_DTYPE_OTHER, null, false);
     $this->initVar('pid', XOBJ_DTYPE_INT, 0, false);
     $this->initVar('date', XOBJ_DTYPE_INT, null, false);
     $this->initVar('nohtml', XOBJ_DTYPE_INT, 1, false);
     $this->initVar('nosmiley', XOBJ_DTYPE_INT, 0, false);
     $this->initVar('noxcode', XOBJ_DTYPE_INT, 0, false);
     $this->initVar('user_id', XOBJ_DTYPE_INT, null, false);
     $this->initVar('icon', XOBJ_DTYPE_OTHER, null, false);
     $this->initVar('prefix', XOBJ_DTYPE_OTHER, null, false);
     if (!empty($id)) {
         if (is_array($id)) {
             $this->assignVars($id);
         } else {
             $this->load((int) $id);
         }
     }
 }
开发者ID:geekwright,项目名称:XoopsCore25,代码行数:32,代码来源:xoopscomments.php


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