Ejemplo n.º 1
0
/**
 * 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>";
            }
        }
    }
}
Ejemplo n.º 2
0
?>
   <form name="picture_menu" id="cpgform" method="post" action="delete.php?what=picmgr" onSubmit="return CheckPictureForm(this);">
   <input type="hidden" name="delete_picture" value="" />
   <input type="hidden" name="sort_order" value="<?php 
echo $sort_order;
?>
" />
   <td class="tableb" valign="top" align="center">
      <br />
      <table width="300" border="0" cellspacing="0" cellpadding="0">
<?php 
//Joe Ernst - Added USER_ADMIN_MODE
if (GALLERY_ADMIN_MODE || USER_ADMIN_MODE) {
    $ALBUM_LIST = array();
    $ALBUM_LIST[] = array(0, $lang_picmgr_php['no_album']);
    get_album_data(FIRST_USER_CAT + USER_ID, '');
    echo <<<EOT
      <tr>
         <td>
            <b>{$lang_picmgr_php['select_album']}</b>
EOT;
    print albumselect('aid');
    echo <<<EOT
         </td>
      </tr>

EOT;
}
?>
      <tr>
         <td>