示例#1
0
文件: admcat.php 项目: jacadym/picman
         }
         $cat_rnum = $cat_lnum + 1;
         /*
         			echo 
         			'<BR><BR>'.
         			FramedTable1().
         			"Parent :: ID:$parent_id ($parent_lnum,$parent_rnum)<BR>".
         			"Category :: ID:$page_id ($cat_lnum,$cat_rnum)<BR>".
         			"NEW :: MODE:$frm[inspos]".
         			'<BR><BR>'.
         			FramedTable2();
         */
         db_query("BEGIN");
         db_query("UPDATE {categories} SET lnum = lnum + 2 WHERE lnum >= {$cat_lnum}");
         db_query("UPDATE {categories} SET rnum = rnum + 2 WHERE rnum >= {$cat_lnum}");
         db_query("INSERT INTO {categories} (" . "uniqid,id_parent,date_create," . "name,title,header,description," . "hidden,catdir,template,options," . "catrows,catcols,colrows,colcols," . "lnum, rnum) VALUES (\n\t\t\t'" . FrmDb($frm[uniqid]) . "', {$parent_id}, '" . $frm[datecr] . "',\n\t\t\t'" . FrmDb($frm[name]) . "', '" . FrmDb($frm[title]) . "', '" . FrmDb($frm[header]) . "','" . FrmDb($frm[desc]) . "',\n\t\t\t{$option_hidden}, '" . FrmDb($frm[dircat]) . "', '" . FrmDb($frm[dirtem]) . "', '',\n\t\t\t{$frm['catrow']}, {$frm['catcol']}, {$frm['grrow']}, {$frm['grcol']},\n\t\t\t{$cat_lnum}, {$cat_rnum}\n\t\t\t)");
         db_query("COMMIT");
         echo '<BR><BR>' . FramedTable1() . '<BR> &nbsp; OK! Created new category "' . $frm[name] . '" &nbsp; <BR><BR>' . FramedTable2();
     }
     break;
 case 'del':
     $result = db_query("SELECT uniqid, name, id_parent, lnum, rnum FROM {categories} WHERE id = {$page_id}");
     if (db_num_rows($result)) {
         $item = db_fetch_array($result);
         $quantity = db_fetch_array(db_query("SELECT count(*) FROM {collections} WHERE uid_cat = '%s'", $item['uniqid']));
         if ($quantity['count'] > 0 || $item['rnum'] - $item['lnum'] > 1) {
             echo '<BR><BR>' . FramedTable1() . '<BR> &nbsp; Sorry! Category is not empty! &nbsp; <BR><BR>' . FramedTable2();
         } else {
             db_query("BEGIN");
             db_query("UPDATE {categories} SET lnum = lnum - 2  WHERE lnum > %d", $item['rnum']);
             db_query("UPDATE {categories} SET rnum = rnum - 2  WHERE rnum > %d", $item['rnum']);
示例#2
0
文件: admcol.php 项目: jacadym/picman
                            db_query("INSERT INTO {tags} (id, name) VALUES (%d, '%s')", $id, $tag);
                            $tags[$id] = $tag;
                            array_push($tagids, $id);
                        }
                    }
                }
                db_query("DELETE FROM {tag_collections} WHERE id_col = %d", $page_id);
                if (count($tagids)) {
                    db_query("INSERT INTO {tag_collections} (id_tag,id_col) SELECT id, %d FROM {tags} WHERE id IN (%s)", $page_id, join(',', $tagids));
                }
                $cat = db_fetch_array(db_query("SELECT uniqid FROM {categories} WHERE id = %d", $frm['parent']));
                $result = db_query("\n\t\t\tUPDATE {collections} SET\n\t\t\tuid_cat     = '%s',\n\t\t\tuniqid      = '%s',\n\t\t\tweight      = %d,\n\t\t\tdate_create = '%s',\n\t\t\tname        = '%s',\n\t\t\ttitle       = '%s',\n\t\t\theader      = '%s',\n\t\t\tdescription = '%s',\n\t\t\tstartnum    = %d,\n\t\t\tquantity    = %d,\n\t\t\tholes       = '%s',\n\t\t\tcoldir      = '%s',\n\t\t\tpicsubdir   = '%s',\n\t\t\tthumbsubdir = '%s',\n\t\t\tpictemp     = '%s',\n\t\t\tthumbtemp   = '%s',\n\t\t\tpgnumtemp   = '%s',\n\t\t\timgindex    = '%s',\n\t\t\ticoindex    = '%s',\n\t\t\trows        = %d,\n\t\t\tcols        = %d,\n\t\t\toptions     = '%s'\n\t\t\tWHERE id = %d", $cat['uniqid'], FrmDb($frm['uniqid']), $frm['position'], $frm['datecr'], FrmDb($frm['name']), FrmDb($frm['title']), FrmDb($frm['header']), FrmDb($frm['desc']), $frm['first'], $frm['quantity'], FrmDb($frm['holes']), FrmDb($frm['dirgr']), FrmDb($frm['dirimg']), FrmDb($frm['dirth']), FrmDb($frm['tempimg']), FrmDb($frm['tempth']), FrmDb($frm['temppage']), FrmDb($frm['introimg']), FrmDb($frm['thumbimg']), $frm['serrow'], $frm['sercol'], join('|', $arr_opt), $page_id);
                echo FramedTable1() . '<BR> &nbsp; OK! Modify Collection "' . $frm[name] . '" &nbsp; <BR><BR>' . FramedTable2();
            } else {
                // Tworzenie nowej grupy
                $result = db_query("INSERT INTO {collections} ( " . "uid_cat,uniqid," . "weight,date_create," . "name,title,header,description," . "startnum,quantity,holes," . "coldir,picsubdir,thumbsubdir," . "pictemp,thumbtemp,pgnumtemp," . "imgindex,icoindex," . "rows,cols,options" . ") SELECT\n\t\t\tC.uniqid, '" . FrmDb($frm[uniqid]) . "',\n\t\t\t{$frm['position']}, '" . $frm[datecr] . "',\n\t\t\t'" . FrmDb($frm[name]) . "', '" . FrmDb($frm[title]) . "', '" . FrmDb($frm[header]) . "', '" . FrmDb($frm[desc]) . "',\n\t\t\t{$frm['first']}, {$frm['quantity']}, '" . FrmDb($frm[holes]) . "',\n\t\t\t'" . FrmDb($frm[dirgr]) . "', '" . FrmDb($frm[dirimg]) . "', '" . FrmDb($frm[dirth]) . "',\n\t\t\t'" . FrmDb($frm[tempimg]) . "', '" . FrmDb($frm[tempth]) . "', '" . FrmDb($frm[temppage]) . "',\n\t\t\t'" . FrmDb($frm[introimg]) . "', '" . FrmDb($frm[thumbimg]) . "',\n\t\t\t{$frm['serrow']}, {$frm['sercol']}, '" . join('|', $arr_opt) . "'\n\t\t\tFROM {categories} C\n\t\t\tWHERE C.id = {$frm['parent']}");
                echo FramedTable1() . '<BR> &nbsp; OK! Created new collection "' . $frm[name] . '" &nbsp; <BR><BR>' . FramedTable2();
            }
            break;
        case 'del':
            echo FramedTable1() . '<BR> &nbsp; Sorry! But delete is not ready yet! &nbsp; <BR><BR>' . FramedTable2();
            break;
        default:
            echo FramedTable1() . '<BR> &nbsp; Sorry! But incorrect action "' . $frm[action] . '" &nbsp; <BR><BR>' . FramedTable2();
            break;
    }
} else {
    DisplayCollectionForm();
}
function DisplayCollectionForm()
{