Exemple #1
0
function b_xoopsPartners_show($options)
{
    global $xoopsDB;
    $myts =& MyTextSanitizer::getInstance();
    $block = array();
    $arrayIds = array();
    if (!empty($options[2])) {
        $arrayIds = xoopspartners_random($options[3]);
    } else {
        $arrayIds = xoopspartners_random($options[3], false, $options[5], $options[6]);
    }
    foreach ($arrayIds as $id) {
        $result = $xoopsDB->query("SELECT id, url, image, title FROM " . $xoopsDB->prefix("partners") . " WHERE id={$id}");
        list($id, $url, $image, $title) = $xoopsDB->fetchrow($result);
        $url = $myts->makeTboxData4Show($url);
        $origtitle = $title;
        $title = $myts->makeTboxData4Show($title);
        $image = $myts->makeTboxData4Show($image);
        if (strlen($origtitle) > 19) {
            $title = $myts->makeTboxData4Show(substr($origtitle, 0, 19)) . "..";
        }
        $partners['id'] = $id;
        $partners['url'] = $url;
        if (!empty($image) && ($options[4] == 1 || $options[4] == 3)) {
            $partners['image'] = $image;
        }
        if (empty($image) || $options[4] == 2 || $options[4] == 3) {
            $partners['title'] = $title;
        } else {
            $partners['title'] = '';
        }
        $block['partners'][] = $partners;
    }
    if ($options[0] == 1) {
        $block['insertBr'] = true;
    }
    if ($options[1] == 1) {
        $block['fadeImage'] = 'style="filter:alpha(opacity=20);" onmouseover="nereidFade(this,100,30,5)" onmouseout="nereidFade(this,50,30,5)"';
    }
    return $block;
}
function b_marquee_xoopspartners($limit, $dateformat, $itemssize)
{
    $block = array();
    $myts =& MyTextSanitizer::getInstance();
    $arrayIds = array();
    $arrayIds = xoopspartners_random($limit);
    global $xoopsDB;
    foreach ($arrayIds as $id) {
        $result = $xoopsDB->query("SELECT id, url, image, title FROM " . $xoopsDB->prefix("partners") . " WHERE id={$id}");
        list($id, $url, $image, $title) = $xoopsDB->fetchrow($result);
        $origtitle = $title;
        $title = $myts->htmlSpecialChars($title);
        if ($itemssize > 0) {
            $title = $myts->htmlSpecialChars(substr($origtitle, 0, 19));
        } else {
            $title = $myts->htmlSpecialChars($origtitle);
        }
        $block[] = array('date' => '', 'category' => '', 'author' => '', 'title' => $title, 'link' => "<a href='" . XOOPS_URL . '/modules/xoopspartners/vpartner.php?id=' . $id . "'>" . $title . '</a>');
    }
    return $block;
}