Example #1
0
function setCategory($category)
{
    global $dbOut, $categoryIds;
    $priorityNumber = 1;
    $newFormat = array("name" => $category['Name'], "parent" => $category['Parent'], "priority" => $category['priority']);
    $dbOut->insert("categories", $newFormat);
    $lastInsert = $dbOut->getLastInsertedId();
    $categoryIds[$category['ID']] = $lastInsert;
    foreach ($category['sub'] as $subCategory) {
        $subCategory['priority'] = $priorityNumber;
        $priorityNumber++;
        $subCategory['Parent'] = $lastInsert;
        setCategory($subCategory);
    }
}
		</script>
		<?php 
            }
            ?>
		</div>
		<?php 
        } else {
            if ($_GET["mode"] == 'edit_album' || $_GET["mode"] == 'applyedit_album') {
                ?>
		<div style="opacity:1;width: 100%;height: 100%;" id="index-loader">
		<?php 
                if ($_GET["mode"] == 'applyedit_album') {
                    $album = $_POST['album'];
                    $album = mysql_real_escape_string($album);
                    $album_title = $_POST['album_title'];
                    $album_title = setCategory($album_title);
                    $album_title = mysql_real_escape_string($album_title);
                    $showto = $_POST['showto'];
                    $cover1 = $_POST['cover1'];
                    $cover2 = $_POST['cover2'];
                    $cover3 = $_POST['cover3'];
                    $query = mysql_query("UPDATE gallerybykk_" . $sitelang . " SET album = '{$album_title}', cover1 = '{$cover1}', cover2 = '{$cover2}',\n\t\t\t\t\tcover3='{$cover3}', showto = '{$showto}' WHERE album = '{$album}' ;", $db);
                    if ($query) {
                        ?>
				<div id="success_dialog" style="display: block;opacity:1;top: 40%;height: 60px;">
				<img alt="correct" src="../images/correct.png" style="float: left;position: relative;height: 60px;"/>
				<div style="font-size: 15px;color: #333;padding: 20px 5px;font-weight: bold;float:left;">Changes Applied!</div>
				</div>
				<script type="text/javascript">
				$("#success_dialog").click(function(){
						$(this).remove();
 } else {
     $category = explode("|bykk|", $category);
     $category_picture = $category[1];
     $category = $category[0];
     $category = setCategory($category);
 }
 $sub_category = $_POST["sub_category"];
 if ($sub_category == 'other') {
     $sub_category = $_POST["sub_category_name"];
     $sub_category = setCategory($sub_category);
     $sub_category_picture = '';
 } else {
     $sub_category = explode("|bykk|", $sub_category);
     $sub_category_picture = $sub_category[1];
     $sub_category = $sub_category[0];
     $sub_category = setCategory($sub_category);
 }
 $showto = $_POST["showto"];
 $attachment = $_FILES["attachment"]["name"];
 $attachment_file = $_FILES["attachment"]["tmp_name"];
 $attachment_type = $_FILES["attachment"]["type"];
 $index1_name = $_POST["index1_name"];
 $index1 = $_POST["index1"];
 if (get_magic_quotes_gpc()) {
     $index1 = stripslashes($index1);
 }
 $index1 = htmlspecialchars($index1, ENT_QUOTES, "UTF-8");
 $index2_name = $_POST["index2_name"];
 $index2 = $_POST["index2"];
 if (get_magic_quotes_gpc()) {
     $index2 = stripslashes($index2);
                $squery = mysql_query("SELECT album FROM gallerybykk_" . $slang . " WHERE state = 1 ORDER BY id  DESC ;", $db);
                $albumCheck = '';
                while ($row = mysql_fetch_row($squery)) {
                    if ($albumCheck != $row[0]) {
                        $albumCheck = $row[0];
                        ?>
					<option value="<?php 
                        echo $row[0];
                        ?>
" <?php 
                        if ($selectedID == $row[0]) {
                            echo 'selected="selected"';
                        }
                        ?>
 ><?php 
                        echo setCategory($row[0]);
                        ?>
</option>
				<?php 
                    }
                }
                ?>
	</select>
	<?php 
            } else {
                if ($smode == '4') {
                    ?>
		<div class="lable" >Weblink</div>
		<input class="textbykk" type="text" id="linkid<?php 
                    echo $slink;
                    ?>
                    ?>
" onclick="gotoPage('full',500,'index/gallery.php');" >Gallery</a></span>
			<span class="pn-spacer" >&gt;</span>
			<span class="pn-item" ><a href="?cmode=full&command=<?php 
                    echo encodeURIComponent("index/gallery.php?gtoshow=" . $id);
                    ?>
" onclick="gotoPage('full',500,'index/gallery.php?gtoshow=<?php 
                    echo $id;
                    ?>
');" ><?php 
                    echo getCategory($id);
                    ?>
</a></span>
		<script>
		window.document.title= "<?php 
                    echo $sitetitle . " | " . setCategory($id);
                    ?>
";
		disableATag();
		</script>
		<?php 
                } else {
                    ?>
			<span class="pn-spacer" >&gt;</span>
			<span class="pn-item" ><a href="?cmode=full&command=<?php 
                    echo encodeURIComponent("index/gallery.php");
                    ?>
" onclick="gotoPage('full',500,'index/gallery.php');" >Gallery</a></span>
		<script>
		window.document.title= "<?php 
                    echo $sitetitle . " | ";