コード例 #1
0
ファイル: partner.php プロジェクト: trabisdementia/xuups
// If the selected partner was not found, exit
if ($partnerObj->notLoaded()) {
    redirect_header("javascript:history.go(-1)", 2, _MD_SPARTNER_NOPARTNERSELECTED);
    exit;
}
include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectpermission.php';
$smartpermissions_handler = new SmartobjectPermissionHandler($smartpartner_partner_handler);
$grantedItems = $smartpermissions_handler->getGrantedItems('full_view');
$grantedItems = array_merge($grantedItems, $smartpermissions_handler->getGrantedItems('partial_view'));
// Chech the status
if ($partnerObj->status() != _SPARTNER_STATUS_ACTIVE || !in_array($id, $grantedItems)) {
    redirect_header("javascript:history.go(-1)", 2, _NOPERM);
    exit;
}
// Updating the counter
$partnerObj->updateHits_page();
// Populating the smarty variables with informations related to the selected Partner
$partner = $partnerObj->toArray();
// Creating the files object associated with this item
$filesObj = $partnerObj->getFiles();
$files = array();
$embeded_files = array();
foreach ($filesObj as $fileObj) {
    if ($fileObj->mimetype() == 'application/x-shockwave-flash') {
        $file['content'] = $fileObj->displayFlash();
        if (strpos($partner['maintext'], '[flash-' . $fileObj->getVar('fileid') . ']')) {
            $partner['maintext'] = str_replace('[flash-' . $fileObj->getVar('fileid') . ']', $file['content'], $partner['maintext']);
        } else {
            $embeded_files[] = $file;
        }
        unset($file);