コード例 #1
0
function b_show_rmsrv_banners()
{
    global $xoopsDB;
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    list($num) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM " . $xoopsDB->prefix("rmsrv_banners")));
    if ($num <= 0) {
        return;
    }
    if ($num > 1) {
        $num = $num - 1;
        mt_srand((double) microtime() * 1000000);
        $snum = mt_rand(0, $num);
    } else {
        $snum = 0;
    }
    $sql = "SELECT * FROM " . $xoopsDB->prefix("rmsrv_banners") . " LIMIT {$snum}, 1";
    $result = $xoopsDB->query($sql);
    $row = $xoopsDB->fetchArray($result);
    $rtn = array();
    include_once XOOPS_ROOT_PATH . "/modules/rmservices/include/functions.php";
    if ($row['buy']) {
        $form = FormBuy(ServiceData($row['id_srv'], "nombre"), ServiceData($row['id_srv'], "codigo"), ServiceData($row['id_srv'], "precio"), 'srv');
    }
    $rtn['id'] = $row['id_ban'];
    $rtn['img'] = str_replace('{servicio}', $row['id_srv'], $row['img']);
    $rtn['desc'] = $myts->makeTareaData4Show($row['desc']);
    $rtn['border'] = $row['showborder'];
    $rtn['ids'] = $row['id_srv'];
    $rtn['form'] = $form;
    $block['bann'][] = $rtn;
    return $block;
}
コード例 #2
0
ファイル: functions.php プロジェクト: BackupTheBerlios/soopa
function GetPromosRel($idp)
{
    global $xoopsDB, $xoopsTpl;
    $result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix("rmsrv_promosrel") . " WHERE id_promo='{$idp}'");
    while ($row = $xoopsDB->fetchArray($result)) {
        $xoopsTpl->append('servicios', array('id' => $row['id_srv'], 'nombre' => ServiceData($row['id_srv']), 'desc' => ServiceData($row['id_srv'], 'shortdesc')));
    }
}