예제 #1
0
파일: d3pipes.php 프로젝트: nouphet/rata
function b_gnavi_d3pipes_joints($options)
{
    global $xoopsDB;
    $mydirname = empty($options[0]) ? basename(dirname(dirname(__FILE__))) : $options[0];
    if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
        die('Invalid mydirname');
    }
    require dirname(dirname(__FILE__)) . '/include/read_configs.php';
    $cat_limitation = empty($options[1]) ? 0 : 1;
    $photos_num = empty($options[2]) ? 10 : intval($options[2]);
    $show_desc = empty($options[3]) ? 0 : 1;
    $query = "ORDER BY unixtime DESC";
    $title_max_length = 255;
    // Category limitation
    if ($cat_limitation) {
        include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
        $cattree = new XoopsTree($table_cat, "cid", "pid");
        $children = $cattree->getAllChildId($cat_limitation);
        $whr_cat = "l.cid IN (";
        foreach ($children as $child) {
            $whr_cat .= "{$child},";
        }
        $whr_cat .= "{$cat_limitation})";
        for ($i = 1; $i <= 4; $i++) {
            $whr_cat .= " OR l.cid{$i} IN (";
            foreach ($children as $child) {
                $whr_cat .= "{$child},";
            }
            $whr_cat .= "{$cat_limitation})";
        }
        $whr_cat = "(" . $whr_cat . ")";
    } else {
        $whr_cat = '1';
    }
    $block = array();
    $myts =& MyTextSanitizer::getInstance();
    if ($show_desc) {
        $result = $xoopsDB->query("SELECT l.lid , l.cid , l.title , l.ext , l.res_x , l.res_y , l.submitter , l.status , l.date AS unixtime , l.hits , l.rating , l.votes , l.comments , c.title AS cat_title ,t.description ,t.arrowhtml FROM {$table_photos} l LEFT JOIN {$table_cat} c ON l.cid=c.cid LEFT JOIN {$table_text} t ON l.lid=t.lid WHERE l.status>0 AND {$whr_cat} {$query}", $photos_num, 0);
    } else {
        $result = $xoopsDB->query("SELECT l.lid , l.cid , l.title , l.ext , l.res_x , l.res_y , l.submitter , l.status , l.date AS unixtime , l.hits , l.rating , l.votes , l.comments , c.title AS cat_title FROM {$table_photos} l LEFT JOIN {$table_cat} c ON l.cid=c.cid WHERE l.status>0 AND {$whr_cat} {$query}", $photos_num, 0);
    }
    $count = 1;
    while ($photo = $xoopsDB->fetchArray($result)) {
        $photo['title'] = xoops_substr($myts->makeTboxData4Show($photo['title']), 0, $title_max_length + 3);
        $photo['cat_title'] = $myts->makeTboxData4Show($photo['cat_title']);
        $photo['date'] = formatTimestamp($photo['unixtime'], 's');
        if ($show_desc) {
            $photo['body'] = xoops_substr(strip_tags($myts->displayTarea($photo['description'], $photo['arrowhtml'], 1, 1, 1, 1, 1)), 0, 512);
        } else {
            $photo['body'] = '';
        }
        $photo['date'] = formatTimestamp($photo['unixtime'], 's');
        $block['photo'][$count++] = $photo;
    }
    $block['mod_url'] = $mod_url;
    return $block;
}
예제 #2
0
    die(_MD_D3FORUM_ERR_READFORUM);
}
// get&check this category ($category4assign, $category_row), override options
if (!(include dirname(dirname(__FILE__)) . '/include/process_this_category.inc.php')) {
    die(_MD_D3FORUM_ERR_READCATEGORY);
}
// get $post4assign
include dirname(dirname(__FILE__)) . '/include/process_this_post.inc.php';
// check delete permission
if (empty($can_delete)) {
    die(_MD_D3FORUM_ERR_DELETEPOST);
}
// count children
include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
$mytree = new XoopsTree($db->prefix($mydirname . "_posts"), "post_id", "pid");
$children = $mytree->getAllChildId($post_id);
// special permission check for delete
if ($isadminormod) {
    // admin delete
    // ok
} else {
    if (($uid == $post_row['uid'] || $uid == $post_row['uid_hidden']) && $xoopsModuleConfig['selfdellimit'] > 0) {
        // self delete
        if (time() < $post_row['post_time'] + intval($xoopsModuleConfig['selfdellimit'])) {
            // before time limit
            if (count($children) > 0) {
                // child(ren) exist(s)
                redirect_header(XOOPS_URL . "/modules/{$mydirname}/index.php?post_id={$post_id}", 2, _MD_D3FORUM_DELCHILDEXISTS);
                exit;
            } else {
                // all green for self delete
예제 #3
0
파일: photo.php 프로젝트: nouphet/myalbum-n
    }
    if ($max_h / $max_w > $p['res_y'] / $p['res_x']) {
        if ($p['res_x'] > $max_w) {
            $photo['width_height'] = "width='{$max_w}'";
        }
    } else {
        if ($p['res_y'] > $max_h) {
            $photo['width_height'] = "height='{$max_h}'";
        }
    }
}
$xoopsTpl->assign_by_ref('photo', $photo);
// Category Information
$cid = empty($p['cid']) ? $cid : $p['cid'];
$xoopsTpl->assign('category_id', $cid);
$cids = $cattree->getAllChildId($cid);
$sub_title = preg_replace("/\\'\\>/", "'><img src='{$mod_url}/images/folder16.gif' alt='' />", $cattree->getNicePathFromId($cid, 'title', "viewcat.php?num=" . intval($myalbum_perpage)));
$sub_title = preg_replace("/^(.+)folder16/", '$1folder_open', $sub_title);
$xoopsTpl->assign('album_sub_title', $sub_title);
// Orders
include XOOPS_ROOT_PATH . "/modules/{$mydirname}/include/photo_orders.php";
if (isset($_GET['orderby']) && isset($myalbum_orders[$_GET['orderby']])) {
    $orderby = $_GET['orderby'];
} else {
    if (isset($myalbum_orders[$myalbum_defaultorder])) {
        $orderby = $myalbum_defaultorder;
    } else {
        $orderby = 'lidA';
    }
}
// create category navigation
 function b_myalbum_rphoto_show($options)
 {
     global $xoopsDB;
     $mydirname = empty($options[0]) ? basename(dirname(dirname(__FILE__))) : $options[0];
     $box_size = empty($options[1]) ? 140 : intval($options[1]);
     $photos_num = empty($options[2]) ? 1 : intval($options[2]);
     $cat_limitation = empty($options[3]) ? 0 : intval($options[3]);
     $cat_limit_recursive = empty($options[4]) ? 0 : 1;
     $cycle = empty($options[5]) ? 60 : intval($options[5]);
     $cols = empty($options[6]) ? 1 : intval($options[6]);
     include XOOPS_ROOT_PATH . "/modules/{$mydirname}/include/read_configs.php";
     // Category limitation
     if ($cat_limitation) {
         if ($cat_limit_recursive) {
             include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
             $cattree = new XoopsTree($table_cat, "cid", "pid");
             $children = $cattree->getAllChildId($cat_limitation);
             $whr_cat = "l.cid IN (";
             foreach ($children as $child) {
                 $whr_cat .= "{$child},";
             }
             $whr_cat .= "{$cat_limitation})";
         } else {
             $whr_cat = "l.cid='{$cat_limitation}'";
         }
     } else {
         $whr_cat = '1';
     }
     // WHERE clause for ext
     // $whr_ext = "l.ext IN ('" . implode( "','" , $myalbum_normal_exts ) . "')" ;
     $whr_ext = "1";
     $block = array();
     $myts =& MyTextSanitizer::getInstance();
     // Get number of photo
     $result = $xoopsDB->query("SELECT count(l.lid) FROM {$table_photos} l WHERE status>0 AND {$whr_cat} AND {$whr_ext}");
     list($numrows) = $xoopsDB->fetchRow($result);
     if ($numrows < 1) {
         return $block;
     }
     if ($numrows <= $photos_num) {
         $result = $xoopsDB->query("SELECT l.lid , l.cid , l.title , l.ext , l.res_x , l.res_y , l.submitter , l.status , l.date AS unixtime , l.hits , l.rating , l.votes , l.comments , c.title AS cat_title FROM {$table_photos} l LEFT JOIN {$table_cat} c ON l.cid=c.cid WHERE l.status>0 AND {$whr_cat} AND {$whr_ext}");
     } else {
         $result = $xoopsDB->query("SELECT l.lid FROM {$table_photos} l WHERE l.status>0 AND {$whr_cat} AND {$whr_ext}");
         $lids = array();
         $sel_lids = array();
         while (list($lid) = $xoopsDB->fetchRow($result)) {
             $lids[] = $lid;
         }
         srand(intval(time() / $cycle) * $cycle);
         $sel_lids = array_rand($lids, $photos_num);
         if (is_array($sel_lids)) {
             $whr_lid = '';
             foreach ($sel_lids as $key) {
                 $whr_lid .= $lids[$key] . ",";
             }
             $whr_lid = substr($whr_lid, 0, -1);
         } else {
             $whr_lid = $lids[$sel_lids];
         }
         $result = $xoopsDB->query("SELECT l.lid , l.cid , l.title , l.ext , l.res_x , l.res_y , l.submitter , l.status , l.date AS unixtime , l.hits , l.rating , l.votes , l.comments , c.title AS cat_title FROM {$table_photos} l LEFT JOIN {$table_cat} c ON l.cid=c.cid WHERE l.status>0 AND l.lid IN ({$whr_lid})");
     }
     $count = 1;
     while ($photo = $xoopsDB->fetchArray($result)) {
         $photo['title'] = $myts->makeTboxData4Show($photo['title']);
         $photo['cat_title'] = $myts->makeTboxData4Show($photo['cat_title']);
         $photo['suffix'] = $photo['hits'] > 1 ? 'hits' : 'hit';
         $photo['date'] = formatTimestamp($photo['unixtime'], 's');
         $photo['thumbs_url'] = $thumbs_url;
         if (in_array(strtolower($photo['ext']), $myalbum_normal_exts)) {
             // width&height attirbs for <img>
             if ($box_size <= 0) {
                 $photo['img_attribs'] = "";
             } else {
                 list($width, $height, $type) = getimagesize("{$thumbs_dir}/{$photo['lid']}.{$photo['ext']}");
                 if ($width > $box_size || $height > $box_size) {
                     if ($width > $height) {
                         $photo['img_attribs'] = "width='{$box_size}'";
                     } else {
                         $photo['img_attribs'] = "height='{$box_size}'";
                     }
                 } else {
                     $photo['img_attribs'] = "";
                 }
             }
         } else {
             $photo['ext'] = 'gif';
             $photo['img_attribs'] = '';
         }
         $block['photo'][$count++] = $photo;
     }
     $block['mod_url'] = $mod_url;
     $block['cols'] = $cols;
     return $block;
 }
예제 #5
0
$xoopsTpl->assign('lang_sortby', $sort);
$xoopsTpl->assign('lang_rank', _MD_RANK);
$xoopsTpl->assign('lang_title', _MD_TITLE);
$xoopsTpl->assign('lang_category', _MD_CATEGORY);
$xoopsTpl->assign('lang_hits', _MD_HITS);
$xoopsTpl->assign('lang_rating', _MD_RATING);
$xoopsTpl->assign('lang_vote', _MD_VOTE);
$arr = array();
$result = $xoopsDB->query("select cid, title from " . $xoopsDB->prefix("mylinks_cat") . " where pid=0");
$e = 0;
$rankings = array();
while (list($cid, $ctitle) = $xoopsDB->fetchRow($result)) {
    $rankings[$e]['title'] = sprintf(_MD_TOP10, $myts->htmlSpecialChars($ctitle));
    $query = "select lid, cid, title, hits, rating, votes from " . $xoopsDB->prefix("mylinks_links") . " where status>0 and (cid={$cid}";
    // get all child cat ids for a given cat id
    $arr = $mytree->getAllChildId($cid);
    $size = count($arr);
    for ($i = 0; $i < $size; $i++) {
        $query .= " or cid=" . $arr[$i] . "";
    }
    $query .= ") order by " . $sortDB . " DESC";
    $result2 = $xoopsDB->query($query, 10, 0);
    $rank = 1;
    while (list($lid, $lcid, $ltitle, $hits, $rating, $votes) = $xoopsDB->fetchRow($result2)) {
        $catpath = $mytree->getPathFromId($lcid, "title");
        $catpath = substr($catpath, 1);
        $catpath = str_replace("/", " <span class='fg2'>&raquo;</span> ", $catpath);
        $rankings[$e]['links'][] = array('id' => $lid, 'cid' => $cid, 'rank' => $rank, 'title' => $myts->htmlSpecialChars($ltitle), 'category' => $catpath, 'hits' => $hits, 'rating' => number_format($rating, 2), 'votes' => $votes);
        $rank++;
    }
    $e++;
예제 #6
0
 // Ticket Check
 if (!$xoopsGTicket->check()) {
     redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
 }
 // Delete
 $cid = intval($_POST['delcat']);
 // Category2Group permission の削除 (2.0.3 以前でもうまく動くように)
 // xoops_groupperm_deletebymoditem( $xoopsModule->mid() , 'pical_cat' , $cid ) ;
 $criteria = new CriteriaCompo(new Criteria('gperm_modid', $xoopsModule->mid()));
 $criteria->add(new Criteria('gperm_name', 'pical_cat'));
 $criteria->add(new Criteria('gperm_itemid', intval($cid)));
 $gperm_handler->deleteAll($criteria);
 // Category Notify の削除
 // (必要であれば該当イベント削除の機能も)
 // 対象カテゴリーの子供をWHERE節に追加し、Cat2Group Permissionを削除
 $children = $cattree->getAllChildId($cid);
 $whr = "cid IN (";
 foreach ($children as $child) {
     // WHERE節への追加
     $whr .= "{$child},";
     // Category2Group permission の削除 (2.0.3 以前でもうまく動くように)
     // xoops_groupperm_deletebymoditem( $xoopsModule->mid() , 'pical_cat' , $child ) ;
     $criteria = new CriteriaCompo(new Criteria('gperm_modid', $xoopsModule->mid()));
     $criteria->add(new Criteria('gperm_name', 'pical_cat'));
     $criteria->add(new Criteria('gperm_itemid', intval($child)));
     $gperm_handler->deleteAll($criteria);
 }
 $whr .= "{$cid})";
 // catテーブルからの削除
 if (!mysql_query("DELETE FROM {$cal->cat_table} WHERE {$whr}", $conn)) {
     die(mysql_error());
예제 #7
0
 function itemsCount($inSubCat = 0, $status = '')
 {
     global $xoopsUser;
     include_once XOOPS_ROOT_PATH . '/modules/smartsection/include/functions.php';
     $hModule =& xoops_gethandler('module');
     $smartModule =& $hModule->getByDirname('smartsection');
     $module_id = $smartModule->getVar('mid');
     $gperm_handler =& xoops_gethandler('groupperm');
     $groups = $xoopsUser ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
     $userIsAdmin = ss_userIsAdmin();
     if (!$userIsAdmin) {
         $itemsGranted = $gperm_handler->getItemIds('item_read', $groups, $module_id);
         $grantedItem = new Criteria('itemid', "(" . implode(',', $itemsGranted) . ")", 'IN');
     }
     $criteriaCategory = new criteria('categoryid', $this->categoryid());
     $criteriaStatus = new CriteriaCompo();
     if (!empty($status) && is_array($status)) {
         foreach ($status as $v) {
             $criteriaStatus->add(new Criteria('status', $v), 'OR');
         }
     } elseif (!empty($status) && $status != -1) {
         $criteriaStatus->add(new Criteria('status', $status), 'OR');
     }
     $criteria = new CriteriaCompo();
     $criteria->add($criteriaCategory);
     if (!$userIsAdmin) {
         $criteria->add($grantedItem);
     }
     $criteria->add($criteriaStatus);
     global $smartsection_item_handler;
     $count = $smartsection_item_handler->getCount($criteria);
     unset($criteria);
     if ($inSubCat) {
         include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
         $mytree = new XoopsTree($this->db->prefix("smartsection_categories"), "categoryid", "parentid");
         $subCats = $mytree->getAllChildId($this->categoryid());
         foreach ($subCats as $key => $value) {
             $categoryid = $value['categoryid'];
             // TODO : If I could just go through the CriteriaCompo to only change the categoryCriteria...
             $criteriaCategory = new criteria('categoryid', $categoryid);
             $criteria = new CriteriaCompo();
             $criteria->add($criteriaCategory);
             if (!$userIsAdmin) {
                 $criteria->add($grantedItem);
             }
             $criteria->add($criteriaStatus);
             $count = $count + $smartsection_item_handler->getCount($criteria);
             unset($criteria);
         }
     }
     return $count;
 }
예제 #8
0
    if ($cid == intval($_POST['pid'])) {
        $xoopsDB->query("UPDATE {$table_cat} SET pid='0' WHERE cid='{$cid}'");
    }
    redirect_header("index.php", 1, _AM_CAT_INSERTED);
    exit;
} else {
    if ($action == "update" && !empty($_POST['cid'])) {
        // anti-CSRF (Double Check)
        if (!xoops_refcheck()) {
            die("XOOPS_URL is not included in your REFERER");
        }
        $cid = intval($_POST['cid']);
        $pid = intval($_POST['pid']);
        // Check if new pid was a child of cid
        if ($pid != 0) {
            $children = $cattree->getAllChildId($cid);
            $children[] = $cid;
            foreach ($children as $child) {
                if ($child == $pid) {
                    die("category looping has occurred");
                }
            }
        }
        // update
        $sql = "UPDATE {$table_cat} SET ";
        $cols = array("pid" => "I:N:0", "title" => "50:E:1", "imgurl" => "150:E:0");
        $sql .= mysql_get_sql_set($cols) . " WHERE cid='{$cid}'";
        $xoopsDB->query($sql) or die("DB Error: update category");
        redirect_header("index.php", 1, _AM_CAT_UPDATED);
        exit;
    } else {
예제 #9
0
 function b_myalbum_tophits_show($options)
 {
     global $xoopsDB;
     // For myAlbum-P < 2.70
     if (strncmp($options[0], 'myalbum', 7) != 0) {
         $title_max_length = intval($options[1]);
         $photos_num = intval($options[0]);
         $mydirname = 'myalbum';
     } else {
         $title_max_length = intval($options[2]);
         $photos_num = intval($options[1]);
         $mydirname = $options[0];
     }
     $cat_limitation = empty($options[3]) ? 0 : intval($options[3]);
     $cat_limit_recursive = empty($options[4]) ? 0 : 1;
     $cols = empty($options[6]) ? 1 : intval($options[6]);
     include XOOPS_ROOT_PATH . "/modules/{$mydirname}/include/read_configs.php";
     // Category limitation
     if ($cat_limitation) {
         if ($cat_limit_recursive) {
             include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
             $cattree = new XoopsTree($table_cat, "cid", "pid");
             $children = $cattree->getAllChildId($cat_limitation);
             $whr_cat = "cid IN (";
             foreach ($children as $child) {
                 $whr_cat .= "{$child},";
             }
             $whr_cat .= "{$cat_limitation})";
         } else {
             $whr_cat = "cid='{$cat_limitation}'";
         }
     } else {
         $whr_cat = '1';
     }
     $block = array();
     $myts =& MyTextSanitizer::getInstance();
     $result = $xoopsDB->query("SELECT lid , cid , title , ext , res_x , res_y , submitter , status , date AS unixtime , hits , rating , votes , comments FROM {$table_photos} WHERE status>0 AND {$whr_cat} ORDER BY hits DESC", $photos_num, 0);
     $count = 1;
     while ($photo = $xoopsDB->fetchArray($result)) {
         $photo['title'] = $myts->makeTboxData4Show($photo['title']);
         if (strlen($photo['title']) >= $title_max_length) {
             if (!XOOPS_USE_MULTIBYTES) {
                 $photo['title'] = substr($photo['title'], 0, $title_max_length - 1) . "...";
             } else {
                 if (function_exists('mb_strcut')) {
                     $photo['title'] = mb_strcut($photo['title'], 0, $title_max_length - 1) . "...";
                 }
             }
         }
         $photo['suffix'] = $photo['hits'] > 1 ? 'hits' : 'hit';
         $photo['date'] = formatTimestamp($photo['unixtime'], 's');
         $photo['thumbs_url'] = $thumbs_url;
         if (in_array(strtolower($photo['ext']), $myalbum_normal_exts)) {
             $width_spec = "width='{$myalbum_thumbsize}'";
             if ($myalbum_makethumb) {
                 list($width, $height, $type) = getimagesize("{$thumbs_dir}/{$photo['lid']}.{$photo['ext']}");
                 if ($width <= $myalbum_thumbsize) {
                     // if thumb images was made, 'width' and 'height' will not set.
                     $width_spec = '';
                 }
             }
             $photo['width_spec'] = $width_spec;
         } else {
             $photo['ext'] = 'gif';
             $photo['width_spec'] = '';
         }
         $block['photo'][$count++] = $photo;
     }
     $block['mod_url'] = $mod_url;
     $block['cols'] = $cols;
     return $block;
 }
function pico_updatecategory($mydirname, $cat_id)
{
    $db =& Database::getInstance();
    $requests = pico_get_requests4category($mydirname, $cat_id);
    $set = '';
    foreach ($requests as $key => $val) {
        if ($key == 'cat_vpath' && empty($val)) {
            $set .= "`{$key}`=null,";
        } else {
            $set .= "`{$key}`='" . mysql_real_escape_string($val) . "',";
        }
    }
    // get children
    include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
    $mytree = new XoopsTree($db->prefix($mydirname . "_categories"), "cat_id", "pid");
    $children = $mytree->getAllChildId($cat_id);
    $children[] = $cat_id;
    // loop check
    if (in_array($requests['pid'], $children)) {
        die(_MD_PICO_ERR_PIDLOOP);
    }
    if (!$db->queryF("UPDATE " . $db->prefix($mydirname . "_categories") . " SET " . substr($set, 0, -1) . " WHERE cat_id={$cat_id}")) {
        die(_MD_PICO_ERR_DUPLICATEDVPATH);
    }
    // rebuild category tree
    pico_sync_cattree($mydirname);
    return $cat_id;
}
function b_bulletin_category_new_show($options)
{
    $mydirname = $options[0];
    if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
        die('Invalid mydirname');
    }
    $selected_order = empty($options[1]) || !in_array($options[1], b_bulletin_category_new_allowed_order()) ? 'published DESC' : $options[1];
    require dirname(dirname(__FILE__)) . '/include/configs.inc.php';
    require_once XOOPS_ROOT_PATH . '/class/xoopstree.php';
    $mytree = new XoopsTree($table_topics, 'topic_id', 'topic_pid');
    $arr = array();
    // ルートカテゴリを得るクエリ
    if (empty($options[4])) {
        // 全ルートカテゴリを得る
        $result = $xoopsDB->query("SELECT topic_id, topic_title, topic_imgurl FROM {$table_topics} WHERE topic_pid=0 ORDER BY topic_title");
    } else {
        // 指定カテゴリのみ
        $result = $xoopsDB->query("SELECT topic_id, topic_title, topic_imgurl FROM {$table_topics} WHERE topic_id=" . $options[4]);
    }
    $block = array();
    while (list($topic_id, $topic_title, $topic_imgurl) = $xoopsDB->fetchRow($result)) {
        $topic = array();
        $topic['title'] = $myts->makeTboxData4Show($topic_title);
        $topic['id'] = $topic_id;
        // トピック画像をセット
        if ($topic_imgurl != '' && file_exists($bulletin_topicon_path . $topic_imgurl) && $options[6]) {
            $topic['topic_url'] = str_replace(XOOPS_ROOT_PATH, XOOPS_URL, $bulletin_topicon_path) . $topic_imgurl;
        }
        $where = sprintf("s.type > 0 AND s.published < %u AND s.published > 0 AND (s.expired = 0 OR s.expired > %1\$u) AND s.block = 1 AND (s.topicid=%u", time(), $topic_id);
        // 子ディレクトリを対象に含める
        $arr = $mytree->getAllChildId($topic_id);
        $size = count($arr);
        for ($i = 0; $i < $size; $i++) {
            $where .= " OR s.topicid=" . $arr[$i];
        }
        $where .= ")";
        $order = "ORDER BY {$selected_order}";
        // more をセット
        $sql = sprintf('SELECT COUNT(*) FROM %s s WHERE %s', $table_stories, $where);
        list($count) = $xoopsDB->fetchRow($xoopsDB->query($sql));
        if ($count > $options[2]) {
            $topic['morelink'] = 1;
        }
        // 本文を表示する
        if ($options[5] > 0) {
            $sql = sprintf('SELECT s.storyid, s.topicid, s.title, s.hometext, s.bodytext, s.published, s.expired, s.counter, s.comments, s.uid, s.topicimg, s.html, s.smiley, s.br, s.xcode, t.topic_title, t. topic_imgurl FROM %s s, %s t WHERE %s AND s.topicid = t.topic_id %s', $table_stories, $table_topics, $where, $order);
            $result2 = $xoopsDB->query($sql, $options[5], 0);
            while ($myrow = $xoopsDB->fetchArray($result2)) {
                $fullstory = array();
                // GIJ
                $fullstory['id'] = $myrow['storyid'];
                $fullstory['posttime'] = formatTimestamp($myrow['published'], $bulletin_date_format);
                $fullstory['date'] = formatTimestamp($myrow['published'], $bulletin_date_format);
                $fullstory['published'] = intval($myrow['published']);
                $fullstory['topicid'] = $myrow['topicid'];
                $fullstory['topic'] = $myts->makeTboxData4Show($myrow['topic_title']);
                $fullstory['title'] = $myts->makeTboxData4Show($myrow['title']);
                $fullstory['text'] = $myts->displayTarea($myrow['hometext'], $myrow['html'], $myrow['smiley'], $myrow['xcode'], 1, $myrow['br']);
                $fullstory['hits'] = $myrow['counter'];
                $fullstory['title_link'] = true;
                //ユーザ情報をアサイン
                $fullstory['uid'] = $myrow['uid'];
                $fullstory['uname'] = XoopsUser::getUnameFromId($myrow['uid']);
                $fullstory['realname'] = XoopsUser::getUnameFromId($myrow['uid'], 1);
                $fullstory['morelink'] = '';
                // 文字数カウント処理
                if (myStrlenText($myrow['bodytext']) > 1) {
                    $fullstory['bytes'] = sprintf(_MB_BULLETIN_BYTESMORE, myStrlenText($myrow['bodytext']));
                    $fullstory['readmore'] = true;
                } else {
                    $fullstory['bytes'] = 0;
                    $fullstory['readmore'] = false;
                }
                // コメントの数をアサイン
                $ccount = $myrow['comments'];
                if ($ccount == 0) {
                    $fullstory['comentstotal'] = _MB_BULLETIN_COMMENTS;
                } elseif ($ccount == 1) {
                    $fullstory['comentstotal'] = _MB_BULLETIN_ONECOMMENT;
                } else {
                    $fullstory['comentstotal'] = sprintf(_MB_BULLETIN_NUMCOMMENTS, $ccount);
                }
                // 管理者用のリンク
                $fullstory['adminlink'] = 0;
                // トピック画像
                if ($myrow['topicimg']) {
                    $fullstory['topic_url'] = makeTopicImgURL($bulletin_topicon_path, $myrow['topic_imgurl']);
                    $fullstory['align'] = topicImgAlign($myrow['topicimg']);
                }
                $topic['fullstories'][] = $fullstory;
            }
        }
        if ($options[2] - $options[5] > 0) {
            $sql = sprintf('SELECT s.storyid, s.title, s.published, s.expired, s.counter, s.uid FROM %s s WHERE %s %s', $table_stories, $where, $order);
            $result3 = $xoopsDB->query($sql, $options[2] - $options[5], $options[5]);
            while ($myrow = $xoopsDB->fetchArray($result3)) {
                // マルチバイト環境に対応
                $story['title'] = $myts->makeTboxData4Show(xoops_substr($myrow['title'], 0, $options[3] + 3, '...'));
                $story['id'] = $myrow['storyid'];
                $story['date'] = formatTimestamp($myrow['published'], $bulletin_date_format);
                $story['published'] = intval($myrow['published']);
                $story['hits'] = $myrow['counter'];
                $story['uid'] = $myrow['uid'];
                $story['uname'] = XoopsUser::getUnameFromId($myrow['uid']);
                $story['realname'] = XoopsUser::getUnameFromId($myrow['uid'], 1);
                $topic['stories'][] = $story;
            }
        }
        $block['topics'][] = $topic;
    }
    if (!empty($block)) {
        $block['mod_config'] = @$bulletin_configs;
        $block['lang_postedby'] = _POSTEDBY;
        $block['lang_on'] = _ON;
        $block['lang_reads'] = _READS;
        $block['lang_readmore'] = _MB_BULLETIN_READMORE;
        $block['type'] = $selected_order;
        $block['mydirurl'] = XOOPS_URL . '/modules/' . $mydirname;
        $block['mydirname'] = $mydirname;
    }
    return $block;
}
예제 #12
0
foreach (array("cat_description", "cat_template", "cat_entry", "cat_sponsor") as $tag) {
    if (@$_POST[$tag] != $category->getVar($tag)) {
        $category->setVar($tag, $_POST[$tag]);
    }
}
if (art_isAdministrator()) {
    foreach (array("cat_title", "cat_order") as $tag) {
        if ($_POST[$tag] != $category->getVar($tag)) {
            $category->setVar($tag, $_POST[$tag]);
        }
    }
    $cat_pid = @$_POST["cat_pid"];
    if ($cat_pid != $category->getVar("cat_pid") && $cat_pid != $category->getVar("cat_id")) {
        require_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
        $mytree = new XoopsTree(art_DB_prefix("category"), "cat_id", "cat_pid");
        $idarray = $mytree->getAllChildId($category->getVar("cat_id"));
        if (!in_array($cat_pid, $idarray)) {
            $category->setVar("cat_pid", $cat_pid);
        }
    }
    $category->setVar("cat_moderator", empty($_POST["cat_moderator"]) ? array() : $_POST["cat_moderator"]);
}
$error_upload = "";
$cat_image = "";
if (!empty($_FILES['userfile']['name'])) {
    $uploader = new art_uploader(XOOPS_ROOT_PATH . "/" . $xoopsModuleConfig['path_image']);
    if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) {
        if (!$uploader->upload()) {
            $error_upload = $uploader->getErrors();
        } elseif (file_exists($uploader->getSavedDestination())) {
            $cat_image = $uploader->getSavedFileName();
<?php

include dirname(dirname(__FILE__)) . '/include/common_prepend.php';
require_once dirname(dirname(__FILE__)) . '/class/gtickets.php';
$cat_id = intval(@$_GET['cat_id']);
// get&check this category ($category4assign, $category_row), override options
if (!(include dirname(dirname(__FILE__)) . '/include/process_this_category.inc.php')) {
    die(_MD_D3FORUM_ERR_READCATEGORY);
}
// count children
include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
$mytree = new XoopsTree($db->prefix($mydirname . "_categories"), "cat_id", "pid");
$children = $mytree->getAllChildId($cat_id);
// special check for categorymanager
if (!$isadmin) {
    die(_MD_D3FORUM_ERR_CREATECATEGORY);
}
// TRANSACTION PART
require_once dirname(dirname(__FILE__)) . '/include/transact_functions.php';
if (isset($_POST['categoryman_post'])) {
    if (!$xoopsGTicket->check(true, 'd3forum')) {
        redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors());
    }
    d3forum_updatecategory($mydirname, $cat_id);
    if (!empty($_POST['batch_action_turnsolvedon'])) {
        d3forum_transact_turnsolvedon_in_category($mydirname, $cat_id);
    }
    redirect_header(XOOPS_URL . "/modules/{$mydirname}/index.php?cat_id={$cat_id}", 2, _MD_D3FORUM_MSG_CATEGORYUPDATED);
    exit;
}
if (isset($_POST['categoryman_delete']) && count($children) == 0) {
예제 #14
0
function b_bulletin_category_new_show($options) {

	$mydirname = empty( $options[0] ) ? basename( dirname( dirname( __FILE__ ) ) ) : $options[0] ;
	if( preg_match( '/[^0-9a-zA-Z_-]/' , $mydirname ) ) die( 'Invalid mydirname' ) ;
	$selected_order = empty( $options[1] ) || ! in_array( $options[1] , b_bulletin_category_new_allowed_order() ) ? 'published DESC' : $options[1] ;
	$display_count = empty($options[2]) ? 0 :intval($options[2]);//Number display for each category
	$Length_title = empty($options[3]) ? 255 :intval($options[3]);//Length of the title
	$categories = empty($options[4]) ? 0 : array_map( 'intval' , explode( ',' , $options[4] ) ) ;//(0=show all)
	$show_body = empty($options[5]) ? 0 :intval($options[5]);//Number of articles showing body for each category
	$show_category_icon = empty($options[6]) ? 0 :intval($options[6]);//(yes or no) ,Display category icon
//ver3.0 fix
	if ($show_body > $display_count){
		$show_body = $display_count;
	}

	require dirname( dirname( __FILE__ ) ).'/include/configs.inc.php';
	require_once XOOPS_ROOT_PATH.'/class/xoopstree.php';
	require_once dirname(dirname(__FILE__)).'/class/bulletingp.php' ;

	$mytree = new XoopsTree($table_topics,'topic_id','topic_pid');

	$arr = array();
//ver3.0 can_read access
	$gperm =& BulletinGP::getInstance($mydirname) ;
	$can_read_topic_ids = $gperm->makeOnTopics('can_read');
	if (empty($can_read_topic_ids)){
		return false;
	}

	// Query to get the root category
		$sql_topics = "SELECT topic_id, topic_title, topic_imgurl";
		$sql_topics .= " FROM ".$xoopsDB->prefix($mydirname."_topics") ;
	if( empty($categories) ){
		// Get categories all from route
		$sql_topics .= " WHERE topic_pid=0";
		$sql_topics .= " AND topic_id IN (".implode(",",$can_read_topic_ids).")";
		$sql_topics .= " ORDER BY topic_title";
	}else{
		// when category
		$sql_topics .= " WHERE topic_id IN (".implode(",",$categories).")";
		$sql_topics .= " AND topic_id IN (".implode(",",$can_read_topic_ids).")";
	}
	$result = $xoopsDB->query($sql_topics);
	$topics_count = $xoopsDB->getRowsNum($result);
	if (empty($topics_count)){
		return false;
	}

	$block = array();

	while( list($topic_id, $topic_title, $topic_imgurl) = $xoopsDB->fetchRow($result) ){
		$topic = array();
		$topic['title'] = $myts->makeTboxData4Show($topic_title);
		$topic['id'] = $topic_id;

		// Set the image topic
		if ($topic_imgurl != '' && file_exists($bulletin_topicon_path.$topic_imgurl) && $show_category_icon) {
			$topic['topic_url'] = str_replace(XOOPS_ROOT_PATH,XOOPS_URL,$bulletin_topicon_path).$topic_imgurl;
			$topic['show_category_icon'] = 1;
		}else{
			$topic['show_category_icon'] = 0;
		}

		$where = sprintf("s.published < %u AND s.published > 0 AND (s.expired = 0 OR s.expired > %1\$u) AND s.block = 1 AND (s.topicid=%u", time(), $topic_id);
		if (!$gperm->group_perm(2)){
			$where .= " AND s.type > 0";
		}

		// View the directory to include children categorys
		$arr = $mytree->getAllChildId($topic_id);
		$size = count($arr);
		for($i=0;$i<$size;$i++){
			$where .= " OR s.topicid=".$arr[$i];
		}
		$where .= ")";
//ver3.0 can_read access
		$where .= " AND s.topicid IN (".implode(',',$can_read_topic_ids).")";

		// see more... for topics
		$sql = sprintf("SELECT COUNT(*) FROM %s s WHERE %s", $xoopsDB->prefix($mydirname."_stories"), $where);
		list($count) = $xoopsDB->fetchRow($xoopsDB->query($sql));
		if($count>$display_count){
			$topic['morelink'] = 1;
		}
		$topic['lang_morelink'] = _MORE;

//ver3.0
		$sql = "SELECT s.*, t.topic_pid, t.topic_imgurl, t.topic_title, t.topic_created, t.topic_modified";
		$sql .= " FROM " . $xoopsDB->prefix($mydirname."_stories") . " s, " . $xoopsDB->prefix($mydirname."_topics") . " t";
		$sql .= " WHERE " . $where . " AND s.topicid = t.topic_id";
		$sql .= " ORDER BY $selected_order";

		// Show body
		if($show_body > 0){

//ver2.0	$sql  = sprintf('SELECT s.storyid, s.topicid, s.title, s.hometext, s.bodytext, s.published, s.expired, s.counter, s.comments, s.uid, s.topicimg, s.html, s.smiley, s.br, s.xcode, t.topic_title, t. topic_imgurl FROM %s s, %s t WHERE %s AND s.topicid = t.topic_id %s', $table_stories, $table_topics, $where, $order);

			$result2 = $xoopsDB->query($sql,$show_body,0);

			while ( $myrow = $xoopsDB->fetchArray($result2) ) {
				$fullstory = array() ; // GIJ
				$fullstory['id']       = $myrow['storyid'];
				$fullstory['posttime'] = formatTimestamp($myrow['published'], $bulletin_date_format);
				$fullstory['date']     = formatTimestamp($myrow['published'], $bulletin_date_format);
				$fullstory['published'] = intval($myrow['published']);
				$fullstory['topicid']  = $myrow['topicid'];
				$fullstory['topic']    = $myts->makeTboxData4Show($myrow['topic_title']);
				$fullstory['title']    = $myts->makeTboxData4Show($myrow['title']);
				$fullstory['text']     = $myts->displayTarea($myrow['hometext'],$myrow['html'],$myrow['smiley'],$myrow['xcode'],1,$myrow['br']);
				$fullstory['hits']     = $myrow['counter'];
				$fullstory['title_link'] = true;
				//Assign the user information
				$fullstory['uid']      = $myrow['uid'];
				$fullstory['uname']    = XoopsUser::getUnameFromId($myrow['uid']);
				$fullstory['realname'] = XoopsUser::getUnameFromId($myrow['uid'], 1);
				$fullstory['morelink'] = '';

				// Length counting process
				if ( myStrlenText($myrow['bodytext']) > 1 ) {
					$fullstory['bytes']    = sprintf(_MB_BULLETIN_BYTESMORE, myStrlenText($myrow['bodytext']));
					$fullstory['readmore'] = true;
				}else{
					$fullstory['bytes']    = 0;
					$fullstory['readmore'] = false;
				}

				// Assign a number of comments
				$ccount = $myrow['comments'];
				if( $ccount == 0 ){
					$fullstory['comentstotal'] = _MB_BULLETIN_COMMENTS;
				}elseif( $ccount == 1 ) {
					$fullstory['comentstotal'] = _MB_BULLETIN_ONECOMMENT;
				}else{
					$fullstory['comentstotal'] = sprintf(_MB_BULLETIN_NUMCOMMENTS, $ccount);
				}

				// Links for administrato //old verssion
				$fullstory['adminlink'] = 0;

				// Image Topic
				if ( $myrow['topicimg'] ) {
					$fullstory['topic_url'] = makeTopicImgURL($bulletin_topicon_path, $myrow['topic_imgurl']);
					$fullstory['align']     = topicImgAlign($myrow['topicimg']);
				}
//ver3.0
				$topic_perm = $gperm->get_viewtopic_perm_of_current_user($myrow['topicid'] , $myrow['uid']);
				$fullstory = array_merge($fullstory,$topic_perm);

				$fullstory['type']     = $myrow['type'];
				$fullstory['raw_data'] = $myrow;

				$topic['fullstories'][] = $fullstory;

			}
		}

		if( $display_count - $show_body > 0 ){

//ver2.0	$sql  = sprintf('SELECT s.storyid, s.title, s.published, s.expired, s.counter, s.uid FROM %s s WHERE %s %s', $table_stories, $where, $order);

			$result3 = $xoopsDB->query($sql,$display_count-$show_body,$show_body);

			while ( $myrow = $xoopsDB->fetchArray($result3) ) {

				// Also supports multi-byte
				$story['title']    = $myts->makeTboxData4Show(xoops_substr($myrow['title'], 0 ,intval($Length_title) + 3, '...'));
				$story['id']       = $myrow['storyid'];
				$story['date']     = formatTimestamp($myrow['published'], $bulletin_date_format);
				$story['published'] = intval($myrow['published']);
				$story['hits']     = $myrow['counter'];
				$story['uid']      = $myrow['uid'];
				$story['uname']    = XoopsUser::getUnameFromId($myrow['uid']);
				$story['realname'] = XoopsUser::getUnameFromId($myrow['uid'], 1);

//ver3.0
				$topic_perm = $gperm->get_viewtopic_perm_of_current_user($myrow['topicid'] , $myrow['uid']);
				$story = array_merge($story,$topic_perm);
				$story['type']     = $myrow['type'];
				$story['raw_data'] = $myrow;

				$topic['stories'][] = $story;
			}

		}

		$block['topics'][] = $topic;
	}

	if( ! empty( $block ) ) {
		$block['mod_config'] = @$bulletin_configs ;
		$block['lang_postedby'] = _POSTEDBY;
		$block['lang_on']       = _ON;
		$block['lang_reads']    = _READS;
		$block['lang_readmore'] = _MB_BULLETIN_READMORE;
		$block['type']  = $selected_order;
		$block['mydirurl'] = XOOPS_URL.'/modules/'.$mydirname;;
		$block['mydirname'] = $mydirname;
	}

	return $block;
}
예제 #15
0
 /**
  * @return array
  */
 public function getAllChildTopicsId()
 {
     $xt = new XoopsTree($this->table, 'topic_id', 'topic_pid');
     $ret = $xt->getAllChildId($this->topic_id, 'topic_title');
     return $ret;
 }
function d3forum_updatecategory($mydirname, $cat_id)
{
    $db =& Database::getInstance();
    $requests = d3forum_get_requests4sql_category($mydirname);
    // get children
    include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
    $mytree = new XoopsTree($db->prefix($mydirname . "_categories"), "cat_id", "pid");
    $children = $mytree->getAllChildId($cat_id);
    $children[] = $cat_id;
    // loop check
    if (in_array($requests['pid'], $children)) {
        die(_MD_D3FORUM_ERR_PIDLOOP);
    }
    if (!$db->query("UPDATE " . $db->prefix($mydirname . "_categories") . " SET cat_title='{$requests['title']}', cat_desc='{$requests['desc']}', cat_weight='{$requests['weight']}', cat_options='{$requests['options']}', pid='{$requests['pid']}' WHERE cat_id={$cat_id}")) {
        die(_MD_D3FORUM_ERR_SQL . __LINE__);
    }
    // rebuild category tree
    d3forum_sync_cattree($mydirname);
    return $cat_id;
}
예제 #17
0
 $topic_handler->insert($newtopic, true);
 $new_topic_id = $newtopic->getVar('topic_id');
 $pid = $post_obj->getVar("pid");
 $post_obj->setVar("topic_id", $new_topic_id, true);
 $post_obj->setVar("pid", 0, true);
 $post_handler->insert($post_obj);
 /* split a single post */
 if ($mode == 1) {
     $criteria = new CriteriaCompo(new Criteria("topic_id", $topic_id));
     $criteria->add(new Criteria('pid', $post_id));
     $post_handler->updateAll("pid", $pid, $criteria, true);
     /* split a post and its children posts */
 } elseif ($mode == 2) {
     include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
     $mytree = new XoopsTree($xoopsDB->prefix("xf_posts"), "post_id", "pid");
     $posts = $mytree->getAllChildId($post_id);
     if (count($posts) > 0) {
         $criteria = new Criteria('post_id', "(" . implode(",", $posts) . ")", "IN");
         $post_handler->updateAll("topic_id", $new_topic_id, $criteria, true);
     }
     /* split a post and all posts coming after */
 } elseif ($mode == 3) {
     $criteria = new CriteriaCompo(new Criteria("topic_id", $topic_id));
     $criteria->add(new Criteria('post_id', $post_id, ">"));
     $post_handler->updateAll("topic_id", $new_topic_id, $criteria, true);
     unset($criteria);
     $criteria = new CriteriaCompo(new Criteria("topic_id", $new_topic_id));
     $criteria->add(new Criteria('post_id', $post_id, ">"));
     $post_handler->identifierName = "pid";
     $posts = $post_handler->getList($criteria);
     unset($criteria);
예제 #18
0
 function getAllChildTopicsId()
 {
     $xt = new XoopsTree($this->table, "topic_id", "topic_pid");
     $ret = $xt->getAllChildId($this->topic_id, "toppic_title");
     return $ret;
 }
예제 #19
0
function b_gnavi_itemblock_show($options, $this_template, $query)
{
    global $xoopsDB;
    $mydirname = empty($options[0]) ? basename(dirname(dirname(__FILE__))) : $options[0];
    if (preg_match('/[^0-9a-zA-Z_-]/', $mydirname)) {
        die('Invalid mydirname');
    }
    require dirname(dirname(__FILE__)) . '/include/read_configs.php';
    $photos_num = empty($options[1]) ? 5 : intval($options[1]);
    $title_max_length = empty($options[2]) ? 20 : intval($options[2]);
    $cat_limitation = empty($options[3]) ? 0 : intval($options[3]);
    $cat_limit_recursive = empty($options[4]) ? 0 : 1;
    $cols = empty($options[6]) ? 1 : intval($options[6]);
    $show_image = empty($options[7]) ? 0 : 1;
    $show_noimage = empty($options[8]) ? 0 : 1;
    $box_size = empty($options[9]) ? 0 : intval($options[9]);
    // Category limitation
    if ($cat_limitation) {
        if ($cat_limit_recursive) {
            include_once XOOPS_ROOT_PATH . "/class/xoopstree.php";
            $cattree = new XoopsTree($table_cat, "cid", "pid");
            $children = $cattree->getAllChildId($cat_limitation);
            $whr_cat = "l.cid IN (";
            foreach ($children as $child) {
                $whr_cat .= "{$child},";
            }
            $whr_cat .= "{$cat_limitation})";
            for ($i = 1; $i <= 4; $i++) {
                $whr_cat .= " OR l.cid{$i} IN (";
                foreach ($children as $child) {
                    $whr_cat .= "{$child},";
                }
                $whr_cat .= "{$cat_limitation})";
            }
            $whr_cat = "(" . $whr_cat . ")";
        } else {
            $whr_cat = "l.cid='{$cat_limitation}'";
        }
    } else {
        $whr_cat = '1';
    }
    // WHERE clause for ext
    if (!$show_noimage) {
        $whr_ext = "l.ext IN ('" . implode("','", $gnavi_normal_exts) . "')";
    } else {
        $whr_ext = "1";
    }
    $block = array();
    $myts =& MyTextSanitizer::getInstance();
    $result = $xoopsDB->query("SELECT l.lid , l.cid , l.title , l.ext , l.res_x , l.res_y , l.submitter , l.status , l.date AS unixtime , l.hits , l.rating , l.votes , l.comments , c.title AS cat_title FROM {$table_photos} l LEFT JOIN {$table_cat} c ON l.cid=c.cid WHERE l.status>0 AND {$whr_cat} AND {$whr_ext} {$query}", $photos_num, 0);
    $count = 1;
    while ($photo = $xoopsDB->fetchArray($result)) {
        $photo['title'] = xoops_substr($myts->makeTboxData4Show($photo['title']), 0, $title_max_length + 3);
        $photo['cat_title'] = $myts->makeTboxData4Show($photo['cat_title']);
        $photo['suffix'] = $photo['hits'] > 1 ? 'hits' : 'hit';
        $photo['date'] = formatTimestamp($photo['unixtime'], 's');
        $photo['thumbs_url'] = $thumbs_url;
        $photo['is_newphoto'] = $photo['unixtime'] > time() - 86400 * $gnavi_newdays && $photo['status'] == 1;
        $photo['is_updatedphoto'] = $photo['unixtime'] > time() - 86400 * $gnavi_newdays && $photo['status'] == 2;
        $photo['is_popularphoto'] = $photo['hits'] >= $gnavi_popular;
        if (in_array(strtolower($photo['ext']), $gnavi_normal_exts)) {
            // width&height attirbs for <img>
            if ($box_size <= 0) {
                $photo['img_attribs'] = "";
            } else {
                if ($photo['res_x'] > $box_size || $photo['res_y'] > $box_size && $gnavi_thumbsize > $box_size) {
                    if ($width > $height) {
                        $photo['img_attribs'] = "width='{$box_size}'";
                    } else {
                        $photo['img_attribs'] = "height='{$box_size}'";
                    }
                } else {
                    $photo['img_attribs'] = "";
                }
            }
        } else {
            if ($photo['ext']) {
                if (file_exists("{$mod_path}/icons/" . $photo['ext'] . ".gif")) {
                    $photo['item'] = "{$mod_url}/icons/" . $photo['ext'] . ".gif";
                } else {
                    $photo['item'] = "{$mod_url}/icons/all.gif";
                }
            } else {
                $photo['item'] = "{$mod_url}/images/noimage.gif";
            }
        }
        $block['photo'][$count++] = $photo;
    }
    $block['mod_url'] = $mod_url;
    $block['cols'] = $cols;
    if (empty($options['disable_renderer'])) {
        require_once XOOPS_ROOT_PATH . '/class/template.php';
        $tpl = new XoopsTpl();
        $tpl->assign('block', $block);
        $ret['content'] = $tpl->fetch($this_template);
        return $ret;
    } else {
        return $block;
    }
}