• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_subcat_data函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: get_subcat_data

function get_subcat_data($parent, $ident = '')
{
    global $CONFIG, $CAT_LIST;
    if ($CONFIG['categories_alpha_sort'] == 1) {
        $sort_query = 'name';
    } else {
        $sort_query = 'pos';
    }
    $sql = "SELECT cid, name, description " . "FROM {$CONFIG['TABLE_CATEGORIES']} " . "WHERE parent = '{$parent}' " . "ORDER BY {$sort_query}";
    $result = cpg_db_query($sql);
    if (($cat_count = mysql_num_rows($result)) > 0) {
        $rowset = cpg_db_fetch_rowset($result);
        $pos = 0;
        foreach ($rowset as $subcat) {
            if ($pos > 0) {
                $CAT_LIST[$subcat['cid']] = array('cid' => $subcat['cid'], 'parent' => $parent, 'pos' => $pos++, 'prev' => $prev_cid, 'cat_count' => $cat_count, 'name' => $ident . $subcat['name']);
                $CAT_LIST[$last_index]['next'] = $subcat['cid'];
            } else {
                $CAT_LIST[$subcat['cid']] = array('cid' => $subcat['cid'], 'parent' => $parent, 'pos' => $pos++, 'cat_count' => $cat_count, 'name' => $ident . $subcat['name']);
            }
            $last_index = $prev_cid = $subcat['cid'];
            // $last_index = count($CAT_LIST) -1;
            get_subcat_data($subcat['cid'], $ident . '   ');
        }
    }
}
开发者ID:phill104,项目名称:branches,代码行数:26,代码来源:catmgr.php


示例2: get_subcat_data

/**
 * get_subcat_data()
 *
 * function get the list of all the subcategories for the given category
 */
function get_subcat_data($parent, $ident = '')
{
    global $CONFIG, $catStr, $parentAlubm;
    if ($parentAlubm != 1) {
        $parentAlubm = 1;
        if ($parent == 0) {
            $catStr .= "\n{$ident}<cat>\n  {$ident}<id>{$parent}</id>\n  {$ident}<name>Parent</name>";
        } else {
            $sql = "SELECT cid, name, description " . "FROM {$CONFIG['TABLE_CATEGORIES']} " . "WHERE cid = '{$parent}' " . "ORDER BY pos";
            $result = cpg_db_query($sql);
            $row = cpg_db_fetch_row($result);
            mysql_free_result($results);
            $catStr .= "\n{$ident}<cat>\n  {$ident}<id>{$row['cid']}</id>\n  {$ident}<name>{$row['name']}</name>";
        }
        get_album_data($parent, "  ");
    }
    if ($parent == 1) {
        /**
         * This is a user category and the categories inside this are not listed in categories table
         * So, we need to loop in the users table and create category id's and get the albums in it
         */
        if (USER_IS_ADMIN) {
            //Get all user albums
            $sql = "SELECT user_name, user_id FROM {$CONFIG['TABLE_USERS']}";
            $result = cpg_db_query($sql);
            if (($cat_count = mysql_num_rows($result)) > 0) {
                $rowset = cpg_db_fetch_rowset($result);
                foreach ($rowset as $cat) {
                    $catStr .= "\n  {$ident}<cat>\n            {$ident}<id>" . (FIRST_USER_CAT + $cat['user_id']) . "</id>\n          {$ident}<name>{$cat['user_name']}</name>";
                    get_album_data(FIRST_USER_CAT + $cat['user_id'], $ident . "  ");
                    $catStr .= "\n  {$ident}</cat>";
                }
            }
        } elseif (USER_ID) {
            //Get only current users albums
            $catStr .= "\n  {$ident}<cat>\n      {$ident}<id>" . (FIRST_USER_CAT + USER_ID) . "</id>\n      {$ident}<name>" . USER_NAME . "</name>";
            get_album_data(FIRST_USER_CAT + USER_ID, $ident . "  ");
            $catStr .= "\n  {$ident}</cat>";
        }
    } else {
        $sql = "SELECT cid, name, description " . "FROM {$CONFIG['TABLE_CATEGORIES']} " . "WHERE parent = '{$parent}' " . "ORDER BY pos";
        $result = cpg_db_query($sql);
        if (($cat_count = mysql_num_rows($result)) > 0) {
            $rowset = cpg_db_fetch_rowset($result);
            $pos = 0;
            foreach ($rowset as $subcat) {
                $catStr .= "\n  {$ident}<cat>\n      {$ident}<id>{$subcat['cid']}</id>\n      {$ident}<name>{$subcat['name']}</name>";
                get_album_data($subcat['cid'], $ident . "  ");
                get_subcat_data($subcat['cid'], $ident . "  ");
                $catStr .= "\n  {$ident}</cat>";
            }
        }
    }
}
开发者ID:phill104,项目名称:branches,代码行数:59,代码来源:cpgAPIcatList.php


示例3: get_subcat_data

function get_subcat_data($parent, $ident = '')
{
    global $CAT_LIST, $xoopsDB;
    $result = $xoopsDB->query("SELECT cid, name, description FROM " . $xoopsDB->prefix("xcgal_categories") . " WHERE parent = '{$parent}' AND cid != 1 ORDER BY pos");
    if ($xoopsDB->getRowsNum($result) > 0) {
        $rowset = db_fetch_rowset($result);
        foreach ($rowset as $subcat) {
            $CAT_LIST[] = array($subcat['cid'], $ident . $subcat['name']);
            get_subcat_data($subcat['cid'], $ident . '&nbsp;&nbsp;&nbsp;');
        }
    }
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:12,代码来源:albmgr.php


示例4: get_subcat_data

function get_subcat_data($parent, $ident = '')
{
    global $db, $CONFIG, $CAT_LIST;
    $result = $db->sql_query("SELECT cid, catname, description FROM {$CONFIG['TABLE_CATEGORIES']} WHERE parent = '{$parent}' AND cid != 1 ORDER BY pos");
    if ($db->sql_numrows($result) > 0) {
        $rowset = $db->sql_fetchrowset($result);
        foreach ($rowset as $subcat) {
            $CAT_LIST[] = array($subcat['cid'], $ident . $subcat['catname']);
            get_subcat_data($subcat['cid'], $ident . '&nbsp;&nbsp;&nbsp;');
        }
    }
}
开发者ID:cbsistem,项目名称:nexos,代码行数:12,代码来源:albmgr.php


示例5: get_subcat_data

function get_subcat_data($parent, &$album_set_array, $level)
{
    global $xoopsDB;
    $result = $xoopsDB->query("SELECT cid, name, description FROM " . $xoopsDB->prefix("xcgal_categories") . " WHERE parent = '{$parent}'");
    if ($xoopsDB->getRowsNum($result) > 0) {
        $rowset = db_fetch_rowset($result);
        foreach ($rowset as $subcat) {
            $result = $xoopsDB->query("SELECT aid FROM " . $xoopsDB->prefix("xcgal_albums") . " WHERE category = {$subcat['cid']}");
            $album_count = $xoopsDB->getRowsNum($result);
            while ($row = $xoopsDB->fetchArray($result)) {
                $album_set_array[] = $row['aid'];
            }
            // while
        }
        if ($level > 1) {
            get_subcat_data($subcat['cid'], $album_set_array, $level - 1);
        }
    }
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:19,代码来源:thumbnails.php


示例6: get_subcat_data

function get_subcat_data($parent, &$album_set_array, $level)
{
    global $CONFIG;
    $result = db_query("SELECT cid, name, description FROM {$CONFIG['TABLE_CATEGORIES']} WHERE parent = '{$parent}'");
    if (mysql_num_rows($result) > 0) {
        $rowset = db_fetch_rowset($result);
        foreach ($rowset as $subcat) {
            $result = db_query("SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} WHERE category = {$subcat['cid']}");
            $album_count = mysql_num_rows($result);
            while ($row = mysql_fetch_array($result)) {
                $album_set_array[] = $row['aid'];
            }
            // while
        }
        if ($level > 1) {
            get_subcat_data($subcat['cid'], $album_set_array, $level - 1);
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:19,代码来源:thumbnails.php


示例7: get_subcat_data

function get_subcat_data($parent, $ident = '')
{
    global $CONFIG, $CAT_LIST, $db;
    $rowset = $db->sql_ufetchrowset('SELECT cid, catname, description FROM ' . $CONFIG['TABLE_CATEGORIES'] . " WHERE parent = '{$parent}' ORDER BY pos", SQL_BOTH, __FILE__, __LINE__);
    if (($cat_count = count($rowset)) > 0) {
        $pos = 0;
        foreach ($rowset as $subcat) {
            if ($pos > 0) {
                $CAT_LIST[] = array('cid' => $subcat['cid'], 'parent' => $parent, 'pos' => $pos++, 'prev' => $prev_cid, 'cat_count' => $cat_count, 'catname' => $ident . $subcat['catname']);
                $CAT_LIST[$last_index]['next'] = $subcat['cid'];
            } else {
                $CAT_LIST[] = array('cid' => $subcat['cid'], 'parent' => $parent, 'pos' => $pos++, 'cat_count' => $cat_count, 'catname' => $ident . $subcat['catname']);
            }
            $prev_cid = $subcat['cid'];
            $last_index = count($CAT_LIST) - 1;
            get_subcat_data($subcat['cid'], $ident . '&nbsp;&nbsp;&nbsp;');
        }
    }
}
开发者ID:cbsistem,项目名称:nexos,代码行数:19,代码来源:catmgr.php


示例8: get_subcat_data

function get_subcat_data($parent, $ident = '')
{
    global $CAT_LIST, $xoopsDB, $myts;
    $sql = "SELECT cid, name, description " . "FROM " . $xoopsDB->prefix("xcgal_categories") . " " . "WHERE parent = '{$parent}' " . "ORDER BY pos";
    $result = $xoopsDB->query($sql);
    if (($cat_count = $xoopsDB->getRowsNum($result)) > 0) {
        $rowset = db_fetch_rowset($result);
        $pos = 0;
        foreach ($rowset as $subcat) {
            if ($pos > 0) {
                $CAT_LIST[] = array('cid' => $subcat['cid'], 'parent' => $parent, 'pos' => $pos++, 'prev' => $prev_cid, 'cat_count' => $cat_count, 'name' => $ident . $myts->makeTboxData4Show($subcat['name']));
                $CAT_LIST[$last_index]['next'] = $subcat['cid'];
            } else {
                $CAT_LIST[] = array('cid' => $subcat['cid'], 'parent' => $parent, 'pos' => $pos++, 'cat_count' => $cat_count, 'name' => $ident . $myts->makeTboxData4Show($subcat['name']));
            }
            $prev_cid = $subcat['cid'];
            $last_index = count($CAT_LIST) - 1;
            get_subcat_data($subcat['cid'], $ident . '&nbsp;&nbsp;&nbsp;');
        }
    }
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:21,代码来源:catmgr.php


示例9: html_cat_list

function html_cat_list()
{
    global $CONFIG, $CAT_LIST;
    global $lang_albmgr_php;
    $CAT_LIST = array();
    if (USER_CAN_CREATE_ALBUMS) {
        $CAT_LIST[] = array(FIRST_USER_CAT + USER_ID, $lang_albmgr_php['my_gallery']);
    }
    $CAT_LIST[] = array(0, $lang_albmgr_php['no_category']);
    get_subcat_data(0, '');
    $html = "\n";
    foreach ($CAT_LIST as $category) {
        $html .= '                        <option value="' . $category[0] . '">' . $category[1] . "</option>\n";
    }
    return $html;
}
开发者ID:BackupTheBerlios,项目名称:copperexport-svn,代码行数:16,代码来源:xp_publish.php


示例10: form_category

function form_category($text, $name)
{
    global $ALBUM_DATA, $CAT_LIST, $USER_DATA, $lang_modifyalb_php, $CONFIG;
    //check if users are allowed to move their albums
    if ($CONFIG['allow_user_move_album'] == 0) {
        //get category name
        $cat_name = $lang_modifyalb_php['user_gal'];
        if ($ALBUM_DATA['category'] != FIRST_USER_CAT + USER_ID) {
            $result = cpg_db_query("SELECT name FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid = '" . $ALBUM_DATA['category'] . "' LIMIT 1");
            $cat_name = cpg_db_fetch_row($result);
            $cat_name = $cat_name['name'];
        }
        echo <<<EOT
        <tr>
            <td class="tableb">
                        {$text}
        </td>
        <td class="tableb" valign="top">
                        <i>{$cat_name}</i>
                        <input type="hidden" name="{$name}" value="{$ALBUM_DATA['category']}" />
                </td>

EOT;
        return;
    }
    $CAT_LIST = array();
    //only add 'no category' when user is admin
    if (GALLERY_ADMIN_MODE) {
        $CAT_LIST[] = array(0, $lang_modifyalb_php['no_cat']);
    }
    //add user catergorie
    $CAT_LIST[] = array(FIRST_USER_CAT + USER_ID, $lang_modifyalb_php['my_gal']);
    get_subcat_data(0, '');
    echo <<<EOT
        <tr>
            <td class="tableb">
                        {$text}
        </td>
        <td class="tableb" valign="top">
                        <select name="{$name}" class="listbox">
EOT;
    foreach ($CAT_LIST as $category) {
        echo '                                <option value="' . $category[0] . '"' . ($ALBUM_DATA['category'] == $category[0] ? ' selected' : '') . ">" . $category[1] . "</option>\n";
    }
    echo <<<EOT
                        </select>
                </td>
        </tr>

EOT;
}
开发者ID:phill104,项目名称:branches,代码行数:51,代码来源:modifyalb.php


示例11: buildCatList

/**
 * Function to build the html for cat list drop down.
 */
function buildCatList()
{
    global $CAT_LIST;
    get_subcat_data(0);
    if (isset($_REQUEST['category'])) {
        $selectedCat = $_REQUEST['category'];
    }
    if ($_REQUEST['category'] === "0") {
        $noCat = " selected";
    }
    $return = "<select name=\"category\" class=\"listbox\" onchange=\"this.form.submit();\">\n";
    $return .= "<option value=\"none\">Select Category</option>\n<option value=\"0\"{$noCat}>No Category</option>\n";
    foreach ($CAT_LIST as $cat) {
        $selected = $selectedCat == $cat['cid'] ? " selected" : "";
        $return .= "<option value=\"{$cat['cid']}\"{$selected}>{$cat['name']}</option>\n";
    }
    $return .= "</select>";
    return $return;
}
开发者ID:phill104,项目名称:branches,代码行数:22,代码来源:mod_lang.php


示例12: get_cat_list

/**
 * get_cat_list()
 *
 *  List all categories
 *
 * @param string $breadcrumb
 * @param array $cat_data
 * @param string $statistics
 * @return void
 **/
function get_cat_list(&$breadcrumb, &$cat_data, &$statistics)
{
    global $CONFIG, $ALBUM_SET, $CURRENT_CAT_NAME, $BREADCRUMB_TEXT, $STATS_IN_ALB_LIST, $FORBIDDEN_SET;
    global $HIDE_USER_CAT, $cpg_show_private_album;
    global $cat;
    global $lang_list_categories, $lang_errors;
    // Build the breadcrumb
    breadcrumb($cat, $breadcrumb, $BREADCRUMB_TEXT);
    // Build the category list
    $cat_data = array();
    $album_set_array = array();
    get_subcat_data($cat, $cat_data, $album_set_array, $CONFIG['subcat_level']);
    $album_filter = '';
    $pic_filter = '';
    $cat = (int) $cat;
    if (!empty($FORBIDDEN_SET) && !$cpg_show_private_album) {
        $album_filter = ' and ' . str_replace('p.', 'a.', $FORBIDDEN_SET);
        $pic_filter = ' and ' . $FORBIDDEN_SET;
    }
    // Add the albums in the current category to the album set
    // if ($cat) {
    if ($cat == USER_GAL_CAT) {
        $sql = "SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} as a WHERE category >= " . FIRST_USER_CAT . $album_filter;
        $result = cpg_db_query($sql);
    } else {
        $sql = "SELECT aid FROM {$CONFIG['TABLE_ALBUMS']} as a WHERE category = '{$cat}'" . $album_filter;
        $result = cpg_db_query($sql);
    }
    while ($row = mysql_fetch_array($result)) {
        $album_set_array[] = $row['aid'];
    }
    // while
    mysql_free_result($result);
    // }
    if (count($album_set_array) && $cat) {
        $set = '';
        foreach ($album_set_array as $album) {
            $set .= $album . ',';
        }
        $set = substr($set, 0, -1);
        $current_album_set = "AND aid IN ({$set}) ";
        $ALBUM_SET .= $current_album_set;
    } elseif ($cat) {
        $current_album_set = "AND aid IN (-1) ";
        $ALBUM_SET .= $current_album_set;
    }
    // Gather gallery statistics - start
    if ($CONFIG['display_stats_on_index'] != 0) {
        if ($cat == 0) {
            $result = cpg_db_query("SELECT count(aid) FROM {$CONFIG['TABLE_ALBUMS']} as a WHERE 1" . $album_filter);
            $nbEnr = mysql_fetch_array($result);
            $album_count = $nbEnr[0];
            mysql_free_result($result);
            $sql = "SELECT count(pid) FROM {$CONFIG['TABLE_PICTURES']} as p " . 'LEFT JOIN ' . $CONFIG['TABLE_ALBUMS'] . ' as a ' . 'ON a.aid=p.aid ' . 'WHERE 1' . $pic_filter . ' AND approved=\'YES\'';
            $result = cpg_db_query($sql);
            $nbEnr = mysql_fetch_array($result);
            $picture_count = $nbEnr[0];
            mysql_free_result($result);
            $sql = "SELECT count(msg_id) FROM {$CONFIG['TABLE_COMMENTS']} as c " . 'LEFT JOIN ' . $CONFIG['TABLE_PICTURES'] . ' as p ' . 'ON c.pid=p.pid ' . 'LEFT JOIN ' . $CONFIG['TABLE_ALBUMS'] . ' as a ' . 'ON a.aid=p.aid ' . 'WHERE 1' . $pic_filter . ' AND approval=\'YES\'';
            $result = cpg_db_query($sql);
            $nbEnr = mysql_fetch_array($result);
            $comment_count = $nbEnr[0];
            mysql_free_result($result);
            $sql = "SELECT count(cid) FROM {$CONFIG['TABLE_CATEGORIES']} WHERE 1";
            $result = cpg_db_query($sql);
            $nbEnr = mysql_fetch_array($result);
            $cat_count = $nbEnr[0] - $HIDE_USER_CAT;
            mysql_free_result($result);
            $sql = "SELECT sum(hits) FROM {$CONFIG['TABLE_PICTURES']} as p " . 'LEFT JOIN ' . $CONFIG['TABLE_ALBUMS'] . ' as a ' . 'ON p.aid=a.aid ' . 'WHERE 1' . $pic_filter;
            $result = cpg_db_query($sql);
            $nbEnr = mysql_fetch_array($result);
            $hit_count = (int) $nbEnr[0];
            mysql_free_result($result);
            if (count($cat_data)) {
                $statistics = strtr($lang_list_categories['stat1'], array('[pictures]' => $picture_count, '[albums]' => $album_count, '[cat]' => $cat_count, '[comments]' => $comment_count, '[views]' => $hit_count));
            } else {
                $STATS_IN_ALB_LIST = true;
                $statistics = strtr($lang_list_categories['stat3'], array('[pictures]' => $picture_count, '[albums]' => $album_count, '[comments]' => $comment_count, '[views]' => $hit_count));
            }
        } elseif ($cat >= FIRST_USER_CAT && $ALBUM_SET) {
            $result = cpg_db_query("SELECT count(aid) FROM {$CONFIG['TABLE_ALBUMS']} WHERE 1 {$current_album_set}");
            $nbEnr = mysql_fetch_array($result);
            $album_count = $nbEnr[0];
            mysql_free_result($result);
            $result = cpg_db_query("SELECT count(pid) FROM {$CONFIG['TABLE_PICTURES']} WHERE 1 {$current_album_set}");
            $nbEnr = mysql_fetch_array($result);
            $picture_count = $nbEnr[0];
            mysql_free_result($result);
            $result = cpg_db_query("SELECT sum(hits) FROM {$CONFIG['TABLE_PICTURES']} WHERE 1 {$current_album_set} AND approved='YES'");
            $nbEnr = mysql_fetch_array($result);
//.........这里部分代码省略.........
开发者ID:phill104,项目名称:branches,代码行数:101,代码来源:index.php


示例13: form_category

function form_category($text, $catname)
{
    global $ALBUM_DATA, $CAT_LIST, $USER_DATA;
    if (!GALLERY_ADMIN_MODE || $ALBUM_DATA['category'] > FIRST_USER_CAT) {
        echo '
        <tr>
            <td class="tableb">
                        ' . $text . '
        </td>
        <td class="tableb" valign="top">
                        <i>' . USER_GAL . '</i>
                        <input type="hidden" name="' . $catname . '" value="' . $ALBUM_DATA['category'] . '" />
                </td>

';
        return;
    }
    $CAT_LIST = array();
    $CAT_LIST[] = array(0, NO_CAT);
    get_subcat_data(0, '');
    echo <<<EOT
        <tr>
            <td class="tableb">
                        {$text}
        </td>
        <td class="tableb" valign="top">
            <form method="post" action="'.URL::index("&amp;file=modifyalb",0,1).'" enctype="multipart/form-data" accept-charset="utf-8">
            <select name="{$catname}" class="listbox">
EOT;
    foreach ($CAT_LIST as $category) {
        echo '<option value="' . $category[0] . '"' . ($ALBUM_DATA['category'] == $category[0] ? ' selected' : '') . ">" . $category[1] . "</option>\n";
    }
    echo <<<EOT
                        </select>
                </td>
        </tr>

EOT;
}
开发者ID:cbsistem,项目名称:nexos,代码行数:39,代码来源:modifyalb.php


示例14: get_cat_list

function get_cat_list(&$cat_data, &$statistics)
{
    global $db, $CONFIG, $BREADCRUMB_TEXT, $STATS_IN_ALB_LIST;
    global $HIDE_USER_CAT;
    global $cat;
    // Build the category list
    $cat_data = array();
    $album_set_array = array();
    $HIDE_USER_CAT = 1;
    get_subcat_data($cat, $cat_data, $album_set_array, 0);
    // Add the albums in the current category to the album set
    if ($cat) {
        if ($cat == USER_GAL_CAT) {
            foreach (get_albums_data() as $row) {
                if ($row['category'] < FIRST_USER_CAT) {
                    continue;
                }
                $album_set_array[] = $row['aid'];
            }
        } else {
            foreach (get_albums_data() as $row) {
                if ($row['category'] != $cat) {
                    continue;
                }
                $album_set_array[] = $row['aid'];
            }
        }
    }
    if (count($album_set_array) && $cat) {
        $set = '';
        foreach ($album_set_array as $album) {
            $set .= $album . ',';
        }
        $set = substr($set, 0, -1);
        $current_album_set = "aid IN ({$set}) ";
    } elseif ($cat) {
        $current_album_set = "aid IN (-1) ";
    }
    // Gather gallery statistics
    if ($cat == 0) {
        $album_count = count(get_albums_data());
        $picture_count = cpg_tablecount($CONFIG['TABLE_PICTURES'], 'count(*)', __FILE__, __LINE__);
        $comment_count = cpg_tablecount($CONFIG['TABLE_COMMENTS'], 'count(*)', __FILE__, __LINE__);
        $cat_count = count(get_categories_data());
        $hit_count = cpg_tablecount($CONFIG['TABLE_PICTURES'], 'sum(hits)', __FILE__, __LINE__);
        if (count($cat_data)) {
            $statistics = strtr(STAT1, array('[pictures]' => $picture_count, '[albums]' => $album_count, '[cat]' => $cat_count, '[comments]' => $comment_count, '[views]' => $hit_count));
        } else {
            $STATS_IN_ALB_LIST = true;
            $statistics = strtr(STAT3, array('[pictures]' => $picture_count, '[albums]' => $album_count, '[comments]' => $comment_count, '[views]' => $hit_count));
        }
    } elseif ($cat >= FIRST_USER_CAT && $current_album_set) {
        $album_count = cpg_tablecount($CONFIG['TABLE_ALBUMS'] . " WHERE {$current_album_set}", 'count(*)', __FILE__, __LINE__);
        $picture_count = cpg_tablecount($CONFIG['TABLE_PICTURES'] . " WHERE {$current_album_set}", 'count(*)', __FILE__, __LINE__);
        $hit_count = cpg_tablecount($CONFIG['TABLE_PICTURES'] . " WHERE {$current_album_set}", 'sum(hits)', __FILE__, __LINE__);
        $statistics = strtr(STAT2, array('[pictures]' => $picture_count, '[albums]' => $album_count, '[views]' => $hit_count));
    } else {
        $statistics = '';
    }
}
开发者ID:cbsistem,项目名称:nexos,代码行数:60,代码来源:index.php


示例15: form_category

function form_category($text, $name)
{
    global $ALBUM_DATA, $CAT_LIST, $USER_DATA, $lang_modifyalb_php;
    if (!GALLERY_ADMIN_MODE || $ALBUM_DATA['category'] > FIRST_USER_CAT) {
        echo <<<EOT
        <tr>
            <td class="tableb">
                        {$text}
        </td>
        <td class="tableb" valign="top">
                        <i>{$lang_modifyalb_php['user_gal']}</i>
                        <input type="hidden" name="{$name}" value="{$ALBUM_DATA['category']}">
                </td>

EOT;
        return;
    }
    $CAT_LIST = array();
    $CAT_LIST[] = array(0, $lang_modifyalb_php['no_cat']);
    get_subcat_data(0, '');
    echo <<<EOT
        <tr>
            <td class="tableb">
                        {$text}
        </td>
        <td class="tableb" valign="top">
                        <select name="{$name}" class="listbox">
EOT;
    foreach ($CAT_LIST as $category) {
        echo '                                <option value="' . $category[0] . '"' . ($ALBUM_DATA['category'] == $category[0] ? ' selected' : '') . ">" . $category[1] . "</option>\n";
    }
    echo <<<EOT
                        </select>
                </td>
        </tr>

EOT;
}
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:38,代码来源:modifyalb.php


示例16: get_cat_list

/**
 * get_cat_list()
 *
 *  List all categories
 *
 * @param string $breadcrumb
 * @param array $cat_data
 * @param string $statistics
 * @return void
 **/
function get_cat_list(&$breadcrumb, &$cat_data, &$statistics)
{
    global $CONFIG, $BREADCRUMB_TEXT, $STATS_IN_ALB_LIST, $FORBIDDEN_SET;
    global $HIDE_USER_CAT, $cpg_show_private_album;
    global $cat;
    global $lang_list_categories;
    // Build the breadcrumb
    breadcrumb($cat, $breadcrumb, $BREADCRUMB_TEXT);
    // Build the category list
    $cat_data = array();
    get_subcat_data($cat_data);
    $album_filter = '';
    $pic_filter = '';
    $cat = (int) $cat;
    if (!empty($FORBIDDEN_SET) && !$cpg_show_private_album) {
        $album_filter = ' ' . str_replace('p.', 'a.', $FORBIDDEN_SET);
        $pic_filter = $FORBIDDEN_SET;
    }
    // Gather gallery statistics - start
    if ($CONFIG['display_stats_on_index'] != 0) {
        if ($cat == 0) {
            $result = cpg_db_query("SELECT COUNT(*) FROM {$CONFIG['TABLE_ALBUMS']} AS a WHERE 1 " . $album_filter);
            $nbEnr = $result->fetchRow(true);
            $album_count = $nbEnr[0];
            $sql = "SELECT COUNT(*) FROM {$CONFIG['TABLE_PICTURES']}";
            if ($pic_filter) {
                $sql .= " AS p INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = p.aid WHERE approved = 'YES' {$pic_filter}";
            } else {
                $sql .= " WHERE approved = 'YES'";
            }
            $result = cpg_db_query($sql);
            $nbEnr = $result->fetchRow(true);
            $picture_count = $nbEnr[0];
            $sql = "SELECT COUNT(*) FROM {$CONFIG['TABLE_COMMENTS']}";
            if ($pic_filter) {
                $sql .= " AS c INNER JOIN {$CONFIG['TABLE_PICTURES']} AS p ON p.pid = c.pid INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = p.aid WHERE 1 {$pic_filter}";
            }
            if ($CONFIG['comment_approval']) {
                if ($pic_filter) {
                    $sql .= " AND approval = 'YES'";
                } else {
                    $sql .= " WHERE approval = 'YES'";
                }
            }
            $result = cpg_db_query($sql);
            $nbEnr = $result->fetchRow(true);
            $comment_count = $nbEnr[0];
            $sql = "SELECT COUNT(*) FROM {$CONFIG['TABLE_CATEGORIES']}";
            $result = cpg_db_query($sql);
            $nbEnr = $result->fetchRow(true);
            $cat_count = $nbEnr[0] - $HIDE_USER_CAT;
            $sql = "SELECT SUM(hits) FROM {$CONFIG['TABLE_PICTURES']}";
            if ($pic_filter) {
                $sql .= " AS p INNER JOIN {$CONFIG['TABLE_ALBUMS']} AS a ON a.aid = p.aid WHERE approved = 'YES' {$pic_filter}";
            } else {
                $sql .= " WHERE approved = 'YES'";
            }
            $result = cpg_db_query($sql);
            $nbEnr = $result->fetchRow(true);
            $hit_count = (int) $nbEnr[0];
            if (count($cat_data)) {
                $statistics = strtr($lang_list_categories['stat1'], array('[pictures]' => '<strong>' . cpg_float2decimal($picture_count) . '</strong>', '[albums]' => '<strong>' . cpg_float2decimal($album_count) . '</strong>', '[cat]' => '<strong>' . cpg_float2decimal($cat_count) . '</strong>', '[comments]' => '<strong>' . cpg_float2decimal($comment_count) . '</strong>', '[views]' => '<strong>' . cpg_float2decimal($hit_count) . '</strong>'));
            } else {
                $STATS_IN_ALB_LIST = true;
                $statistics = strtr($lang_list_categories['stat3'], array('[pictures]' => '<strong>' . cpg_float2decimal($picture_count) . '</strong>', '[albums]' => '<strong>' . cpg_float2decimal($album_count) . '</strong>', '[comments]' => '<strong>' . cpg_float2decimal($comment_count) . '</strong>', '[views]' => '<strong>' . cpg_float2decimal($hit_count) . '</strong>'));
            }
        } else {
            $statistics = '';
        }
    } else {
        // Gather gallery statistics - end
        $statistics = '';
    }
}
开发者ID:CatBerg-TestOrg,项目名称:coppermine,代码行数:84,代码来源:index.php


示例17: cpg_die

        if (!$result->numRows()) {
            cpg_die(ERROR, $lang_catmgr_php['unknown_cat'], __FILE__, __LINE__);
        }
        $del_category = $result->fetchAssoc(true);
        $parent = $del_category['parent'];
        cpg_db_query("UPDATE {$CONFIG['TABLE_CATEGORIES']} SET parent = {$parent}, lft = 0 WHERE parent = {$cid}");
        cpg_db_query("UPDATE {$CONFIG['TABLE_ALBUMS']} SET category = {$parent} WHERE category = {$cid}");
        cpg_db_query("DELETE FROM {$CONFIG['TABLE_CATEGORIES']} WHERE cid = {$cid}");
        //delete from categorymap
        cpg_db_query("DELETE FROM {$CONFIG['TABLE_CATMAP']} WHERE cid = {$cid}");
        break;
}
if ($op) {
    check_rebuild_tree();
}
get_subcat_data(0);
pageheader($lang_catmgr_php['manage_cat']);
starttable('100%', cpg_fetch_icon('cat_mgr', 2) . $lang_catmgr_php['category'] . '&nbsp;' . cpg_display_help('f=categories.htm&amp;as=cat_cp&amp;ae=cat_cp_end&amp;top=1', '800', '600'), 1);
echo <<<EOT
    <tr>
        <td class="tableb">
EOT;
starttable('100%');
// configure sort category alphabetically
$yes_selected = $CONFIG['categories_alpha_sort'] ? 'checked="checked"' : '';
$no_selected = !$CONFIG['categories_alpha_sort'] ? 'checked="checked"' : '';
$help = '&nbsp;' . cpg_display_help('f=configuration.htm&amp;as=admin_album_list_alphasort_start&amp;ae=admin_album_list_alphasort_end&amp;top=1', '600', '250');
echo <<<EOT
        <tr>
            <td class="tablef" colspan="8">
                        <form name="catsortconfig" action="{$CPG_PHP_SELF}" method="post">
开发者ID:CatBerg-TestOrg,项目名称:coppermine,代码行数:31,代码来源:catmgr.php


示例18: get_cat_list

function get_cat_list(&$breadcrumb, &$cat_data, &$statistics)
{
    global $_GET, $xoopsModuleConfig, $ALBUM_SET, $CURRENT_CAT_NAME, $BREADCRUMB_TEXT, $STATS_IN_ALB_LIST;
    global $HIDE_USER_CAT;
    global $xoopsDB, $xoopsModule;
    $cat = isset($_GET['cat']) ? (int) $_GET['cat'] : 0;
    // Build the breadcrumb
    breadcrumb($cat, $breadcrumb, $BREADCRUMB_TEXT);
    // Build the category list
    $cat_data = array();
    $album_set_array = array();
    get_subcat_data($cat, $cat_data, $album_set_array, $xoopsModuleConfig['subcat_level']);
    // Treat the album set
    if ($cat) {
        if ($cat == USER_GAL_CAT) {
            $result = $xoopsDB->query("SELECT aid FROM " . $xoopsDB->prefix("xcgal_albums") . " WHERE category >= " . FIRST_USER_CAT);
        } else {
            $result = $xoopsDB->query("SELECT aid FROM " . $xoopsDB->prefix("xcgal_albums") . " WHERE category = '{$cat}'");
        }
        while ($row = $xoopsDB->fetchArray($result)) {
            $album_set_array[] = $row['aid'];
        }
        // while
        $xoopsDB->freeRecordSet($result);
    }
    if (count($album_set_array) && $cat) {
        $set = '';
        foreach ($album_set_array as $album) {
            $set .= $album . ',';
        }
        $set = substr($set, 0, -1);
        $current_album_set = "AND aid IN ({$set}) ";
        $ALBUM_SET .= $current_album_set;
    } elseif ($cat) {
        $current_album_set = "AND aid IN (-1) ";
        $ALBUM_SET .= $current_album_set;
    }
    // Gather gallery statistics
    if ($cat == 0) {
        $result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix("xcgal_albums") . " WHERE 1");
        $album_count = $xoopsDB->getRowsNum($result);
        $xoopsDB->freeRecordSet($result);
        $result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE 1 AND approved='YES'");
        $picture_count = $xoopsDB->getRowsNum($result);
        $xoopsDB->freeRecordSet($result);
        $comment_count = xoops_comment_count($xoopsModule->mid());
        $result = $xoopsDB->query("SELECT * FROM " . $xoopsDB->prefix("xcgal_categories") . " WHERE 1");
        $cat_count = $xoopsDB->getRowsNum($result) - $HIDE_USER_CAT;
        $xoopsDB->freeRecordSet($result);
        $result = $xoopsDB->query("SELECT sum(hits) FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE 1");
        $nbEnr = $xoopsDB->fetchArray($result);
        $hit_count = (int) $nbEnr['sum(hits)'];
        $xoopsDB->freeRecordSet($result);
        if (count($cat_data)) {
            $statistics = strtr(_MD_INDEX_STAT1, array('[pictures]' => $picture_count, '[albums]' => $album_count, '[cat]' => $cat_count, '[comments]' => $comment_count, '[views]' => $hit_count));
        } else {
            $STATS_IN_ALB_LIST = true;
            $statistics = strtr(_MD_INDEX_STAT3, array('[pictures]' => $picture_count, '[albums]' => $album_count, '[comments]' => $comment_count, '[views]' => $hit_count));
        }
    } elseif ($cat >= FIRST_USER_CAT && $ALBUM_SET) {
        $result = $xoopsDB->query("SELECT count(*) FROM " . $xoopsDB->prefix("xcgal_albums") . " WHERE 1 {$current_album_set}");
        $nbEnr = $xoopsDB->fetchArray($result);
        $album_count = $nbEnr['count(*)'];
        $xoopsDB->freeRecordSet($result);
        $result = $xoopsDB->query("SELECT count(*) FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE 1 {$current_album_set}");
        $nbEnr = $xoopsDB->fetchArray($result);
        $picture_count = $nbEnr['count(*)'];
        $xoopsDB->freeRecordSet($result);
        $result = $xoopsDB->query("SELECT sum(hits) FROM " . $xoopsDB->prefix("xcgal_pictures") . " WHERE 1 {$current_album_set}");
        $nbEnr = $xoopsDB->fetchArray($result);
        $hit_count = (int) $nbEnr['sum(hits)'];
        $xoopsDB->freeRecordSet($result);
        $statistics = strtr(_MD_INDEX_STAT2, array('[pictures]' => $picture_count, '[albums]' => $album_count, '[views]' => $hit_count));
    } else {
        $statistics = '';
    }
}
开发者ID:severnaya99,项目名称:Sg-2010,代码行数:77,代码来源:index.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_subcat_ids函数代码示例发布时间:2022-05-15
下一篇:
PHP get_sub_record函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap