Ejemplo n.º 1
0
function updateTable($inTableNode)
{
    $myAttrList = $inTableNode->attributes();
    $myTableName = $myAttrList["name"];
    $myCmd = $myAttrList["command"];
    echo "\n {$myCmd} table {$myTableName}";
    $myRows = $inTableNode->xpath('Rows/Row');
    $myRowCount = count($myRows);
    if ($myRowCount > 0) {
        foreach ($myRows as $myRow) {
            if ($myCmd == "Delete") {
                deleteRow($myTableName, $inTableNode, $myRow);
            } else {
                if (isRowFound($myTableName, $inTableNode, $myRow)) {
                    updateRow($myTableName, $inTableNode, $myRow);
                } else {
                    insertRow($myTableName, $inTableNode, $myRow);
                }
            }
        }
    }
    echo "\n------------------------------\n";
}
Ejemplo n.º 2
0
<?php

session_start();
$playlist_id = $_REQUEST['playlist_id'];
$content_id = $_REQUEST['content_id'];
$operation = $_REQUEST['operation'];
if (isset($_REQUEST['connection'])) {
    $id_item = $_REQUEST['connection'];
}
if ($operation == 'add1') {
    addToPlaylist($playlist_id, $content_id);
} else {
    if ($operation == 'delete') {
        deleteRow($playlist_id, $content_id);
    } else {
        if ($operation == 'moveUp') {
            moveUp($playlist_id, $content_id, $id_item);
        } else {
            if ($operation == 'moveDown') {
                moveDown($playlist_id, $content_id, $id_item);
            }
        }
    }
}
function moveDown($playlist_id, $content_id, $id_item)
{
    $isUp = false;
    $servername = "localhost";
    $username = "******";
    $password = "******";
    $dbname = "Doopy";
Ejemplo n.º 3
0
/**
 * Expire an article
 * @param integer ID of the article to expire
 * @param integer ID of the level that will be expired
 * @param integer ID of the variation to expire
 */
function expireArticle($articleId, $level, $variation)
{
    global $db;
    $articleIdTrans = translateState($articleId, $level, false);
    clearArticleURL($articleIdTrans, $variation);
    deleteRow("channel_articles", "ARTICLE_ID = {$articleIdTrans}");
    expireCluster($articleId, $variation);
}
Ejemplo n.º 4
0
<?
include 'models/selects.php';
include 'models/deletes.php';

if(isset($_REQUEST['id'])){
	if($_REQUEST['id'] == 'delete'){
	$table = 'blog_form';
	$where = 'id="'.$_REQUEST['id2'].'"';
	$deleteData = deleteRow($table,$where,$db_location, $db_user,$db_pass,$db_db);
	}
}

if(selectAll('blog_form',$db_location, $db_user,$db_pass,$db_db)){
	$theData = selectAll('blog_form',$db_location, $db_user,$db_pass,$db_db);
	foreach($theData as $value){
		$ids[] = $value['id'];
		$title[] = $value['title'];
	}
}else{
	$data['id'] = 'error';
}
?>
<div id="contact_container">
    Admin Blog Page
    <? if(isset($deleteData)){?>
    <h2><?php 
echo $deleteData;
?>
</h2>
    <? }?>
    <hr /><br />
		/**
		 * Does nothing here. process must be done my developer.
		 */
		function process() {
			global $page_state;

			if ($page_state == "processing") {
				$nextIndex = count($this->keys);

				deleteRow($this->table, $this->row_identifier);

				if (is_array($this->properties)) {
					foreach ($this->properties as $key => $value) {
						foreach ($value as $role) {
							$is = $this->keys;

							$is[$nextIndex][0] = $this->column2;
							$is[$nextIndex][1] = $role;
							$is[$nextIndex][2] = $this->column2_dt;

							$is[$nextIndex + 1][0] = $this->column1;
							$is[$nextIndex + 1][1] = $key;
							$is[$nextIndex + 1][2] = $this->column1_dt;

							$cs = new CreateSet($this->table);

							for ($i = 0; $i < count($is); $i++) {
								$cs->add($is[$i][0], $is[$i][1], $is[$i][2]);
							}

							$cs->execute();
						}
					}
				}
			}
		}
Ejemplo n.º 6
0
/**
 * @param $userid
 * @param $weeklyid
 * @return string
 * This will check if a weekly id is still in use. If it is not, it will delete the weekly id.
 */
function checkIfWeeklyIdUsed($userid, $weeklyid)
{
    $mysqli = new mysqli(Database::dbserver, Database::dbuser, Database::dbpass, Database::dbname);
    $sql = "SELECT Count(WeeklyID) AS CountOfWeeklyID from tbl_time WHERE UserID = " . $userid . " AND WeeklyID = " . $weeklyid . " ";
    $rs = $mysqli->query($sql);
    while ($row = $rs->fetch_assoc()) {
        $count = $row['CountOfWeeklyID'];
        if ($count < 1) {
            //we need to delete this weeklyid, it is no longer used.
            deleteRow($userid, $weeklyid);
        }
    }
    $rs->free();
    $mysqli->close();
    return $sql;
}
	  /**
	   * Save all back to the database
	   */
	   function process() {
	       global $db, $oid;
	       deleteRow($this->table, $this->cond);	
	       $ids = explode(",", value($this->table."selection", "NOSPACES"));
	       for ($i=0; $i < count($ids); $i++) {
	         $sql = "INSERT INTO $this->table ($this->idcolumn, $this->fkidcolumn, POSITION) VALUES (".$ids[$i].", $oid, ".($i+1).")";
	         $query = new query($db, $sql);
	         $query->free();
	       }
	   }
Ejemplo n.º 8
0
		/**
		   * Destroy the ACL-Object permanently
		   */
		function destroy() {
			deleteRow("acl_management", "GUID = " . $this->guid);

			deleteRow("acl_relations", "GUID = " . $this->guid);
		}
Ejemplo n.º 9
0
$inventoryQuery = "SELECT InventoryID, \tInventoryDescription, InventoryTypeID,\tPurchasePrice,\tPurchaseLocation,\tInventoryLocationID,\tInventoryOwnerID, Picture1Location, Picture2Location,\tDateSold, InventoryConditionID, UPC, CustomID from tInventory";
switch ($action) {
    case "list":
        break;
    case "sort":
        $listQuery = $listQuery . " ORDER BY {$value}";
        break;
    case "filter":
        $listQuery = $listQuery . " WHERE {$columnName} = {$value}";
        break;
    case "like":
        $listQuery = $listQuery . " WHERE {$columnName} like '%" . $value . "%'";
        break;
    case "delete":
        $deleteQuery = "DELETE FROM tInventory WHERE InventoryID={$value}";
        deleteRow("tInventory", $id, $deleteQuery);
        break;
    case "add":
        if (getReturnValue("tInventory", "UPC", $upc, "ID") == null and getReturnValue("tInventory", "Description", $description, "ID") == null) {
            $addQuery = "INSERT INTO tInventory (InventoryDescription, InventoryTypeID,\tPurchasePrice,\tPurchaseLocation,\tInventoryLocationID,\tInventoryOwnerID, Picture1Location, Picture2Location,\tDateSold, InventoryConditionID, UPC, CustomID) VALUES('{$description}','{$inventoryType}','{$purchasePrice}','{$purchaseLocation}','{$inventoryLocation}','{$inventoryOwner}','{$picture1}','{$picture2}','{$dateSold}','{$inventoryCondition}','{$upc}','{$customID}')";
            if (!($result = mysql_query($addQuery))) {
                echo "<p class='error'>Could not add {$value} " . mysql_error() . "</p>";
            }
        } else {
            echo "<p class='error'>{$value} already exists</p>";
            listData();
        }
        break;
    case "select":
        echo "<form id='edit' method='post' action='inventoryFunction.php' autocomplete='on' type='submit'>";
        echo "<input type='hidden' id='InventoryID' name ='InventoryID' value='{$id}'>";
Ejemplo n.º 10
0
/**
 * Delete a cluster node
 * @param integer Cluster-Node-ID
 * @param boolean also delete version?
 */
function deleteClusterNode($clnid, $recursiveLevels = true)
{
    if ($recursiveLevels) {
        deleteClusterNode(translateState($clnid, 10, false), false);
    }
    $clids = createDBCArray("cluster_variations", "CLID", "CLNID = {$clnid}");
    if (count($clids) > 0) {
        foreach ($clids as $clid) {
            deleteCluster($clid);
        }
    }
    deleteRow("cluster_variations", "CLNID = {$clnid}");
    deleteRow("cluster_node", "CLNID = {$clnid}");
}
 /**
  * Delete the data in the plugins.
  * @param integer ID of the content to delete
  */
 function deleteReferencedItem($id)
 {
     deleteRow("centerstage", "STAGE_ID = {$id}");
 }
    //return $sql;
    $result = ibase_query($sql);
    if ($result) {
        return true;
    } else {
        return false;
    }
}
if ($_REQUEST['sender'] == "entri_penetapan_PajakWalet") {
    if ($_REQUEST['action'] == 'edit') {
        //edit
        if (isset($_SESSION['delete_box'])) {
            //delete process if box is not empty
            foreach ($_SESSION['delete_box']['pwalet_id'] as $key => $id) {
                $params = array('pwalet_id' => $id);
                deleteRow('pendataan_pwalet', $params);
            }
            unset($_SESSION['delete_box']);
            //print_r($_SESSION['delete_box']);
        }
        if (isset($_REQUEST['detail'])) {
            //data detail
            $id_rekening = getIdRekening($_REQUEST['rekening']);
            if ($x = searchRow('pendataan_pwalet', 'pendataan_id', $_REQUEST['FK'], $_REQUEST['id'])) {
                //ada id row, update
                //echo $x;
                $exception = array('pendataan_id', 'pwalet_id');
                $other_request = array('dasar_pengenaan' => $_REQUEST['pengenaan'], 'persen_tarif' => $_REQUEST['persen'], 'id_rekening' => $id_rekening, 'dasar_tarif' => $_REQUEST['tarif'], 'nominal' => $_REQUEST['pajak']);
                ibase_trans();
                $str_where = " where pwalet_id =" . $_REQUEST['id'];
                $b = $fbird->FBUpdate('pendataan_pwalet', $other_request, $exception, $str_where);
Ejemplo n.º 13
0
/**
 * Deletes a sitepage master
 */
function deleteSitepageMaster($spm)
{
    $deleteArray = array();
    $deleteArray[] = $spm;
    $deleteArray[] = translateState($spm, 10, false);
    for ($i = 0; $i < count($deleteArray); $i++) {
        deleteRow("sitepage_variations", "SPM_ID = " . $deleteArray[$i]);
        deleteRow("sitepage_master", "SPM_ID = " . $deleteArray[$i]);
        deleteRow("sitemap", "SPM_ID = " . $deleteArray[$i]);
        $sitepages = createDBCArray("sitepage", "SPID", "SPM_ID = " . $deleteArray[$i]);
        for ($j = 0; $j < count($sitepages); $j++) {
            $da2 = array();
            $da2[] = $sitepages[$j];
            $da2[] = translateState($sitepages[$j], 10, false);
            for ($k = 0; $k < count($da2); $k++) {
                deleteRow("sitepage", "SPID = " . $da2[$k]);
                deleteRow("sitepage_names", "SPID = " . $da2[$k]);
            }
        }
    }
}
Ejemplo n.º 14
0
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php 
include '../Functions/delete-function.php';
include '../Functions/dbconnect.php';
$id = filter_input(INPUT_GET, 'id');
if (deleteRow($id)) {
    echo "Address Deleted, Redirecting you back to the view page in 5 seconds";
    echo '<meta http-equiv="refresh" content="5;url=./index.php" />';
} else {
    echo "Row not deleted, an error has occured";
}
?>
    </body>
</html>
Ejemplo n.º 15
0
         $al->tp->assign('title', 'List of users');
         $al->tp->assign('selMenu', 'user');
         $table = "users";
         $tpl = "view_usertbl.tpl";
         $isDeleted = deleteRow($table, $params[2], $al->db);
         if ($isDeleted === false) {
             break;
         }
         $al->tp->assign('rep', "The user with id = " . $params[2] . " has been deleted.");
     } else {
         if ($params[1] == "category") {
             $al->tp->assign('title', 'List of users');
             $al->tp->assign('selMenu', 'category');
             $table = "categories";
             $tpl = "view_cattbl.tpl";
             $isDeleted = deleteRow($table, $params[2], $al->db);
             if ($isDeleted === false) {
                 break;
             }
             $al->tp->assign('rep', "The category with id = " . $params[2] . " has been deleted.");
         } else {
             Errors::report("Second parameter of url: " . $params[1] . " is not valid.");
             break;
         }
     }
 }
 if (!$al->tp->template_exists($tpl)) {
     Errors::report("Template file: {$tpl} is missing.");
     break;
 }
 $data = getTableData($table, $al->db);
Ejemplo n.º 16
0
$result2 = mysql_query($sql2);
if (mysql_num_rows($result2) > 0) {
    while ($row2 = mysql_fetch_array($result2)) {
        $stockName = $row2['stockname'];
        $purchasePrice = $row2['purchaseprice'];
        $currentClose = getClose($stockName);
        $stopLoss = $row2['stoploss'];
        $remaining = $row2['no_of_stocks'];
        if ($remaining == 0) {
            continue;
        }
        //echo $stockName . " " . $currentClose . " " . $stopLoss;
        if ($currentClose < $stopLoss) {
            $loss = ($currentClose - $purchasePrice) * $remaining;
            modifyGain($loss, $doj, $username);
            deleteRow($doj, $username, $purchasePrice, $stockName);
            echo "{$stockName}";
            exit(0);
        }
    }
}
echo "1";
exit(0);
function modifyGain($loss, $doj, $username)
{
    $sql2 = "SELECT * FROM investments WHERE doj = '{$doj}' AND username = '******'";
    $result2 = mysql_query($sql2);
    if (mysql_num_rows($result2) > 0) {
        while ($row2 = mysql_fetch_array($result2)) {
            $gainLoss = $row2['GainLoss'];
            $gainLoss = $gainLoss + $loss;
Ejemplo n.º 17
0
function deleteRecord($db, $modelName, $record, $roles)
{
    if (!in_array("admin", $roles)) {
        if ($modelName === "school") {
            /* Check that there are no groups attached. We don't care anymore, and keep the groups.
               $query = "SELECT count(`group`.`ID`) as `nbGroups` FROM `group` WHERE `group`.`schoolID` = :schoolID AND `group`.`userID` = :userID";
               $stmt = $db->prepare($query);
               $stmt->execute(array("schoolID" => $record["ID"], "userID" => $_SESSION["userID"]));
               $row = $stmt->fetchObject();
               if ((!$row) || ($row->nbGroups > 0)) {
                  return;
               }
               */
            $query = "SELECT `school_user`.`ID` FROM `school_user` WHERE `schoolID` = :schoolID AND `userID` = :userID";
            $stmt = $db->prepare($query);
            $stmt->execute(array("schoolID" => $record["ID"], "userID" => $_SESSION["userID"]));
            $row = $stmt->fetchObject();
            if (!$row) {
                return;
            }
            deleteRow($db, "school_user", array("ID" => $row->ID));
            return;
        } else {
            if ($modelName === "group") {
                $query = "SELECT `group`.`userID`, count(`team`.`ID`) as `nbTeams` " . "FROM `group` LEFT JOIN `team` ON (`team`.`groupID` = `group`.`ID`) " . "WHERE `group`.`ID` = :ID GROUP BY `group`.`ID`";
                $stmt = $db->prepare($query);
                $stmt->execute(array("ID" => $record["ID"]));
                $row = $stmt->fetchObject();
                if (!$row || $row->userID !== $_SESSION["userID"] || $row->nbTeams > 0) {
                    return;
                }
            } else {
                if ($modelName === "school_user") {
                } else {
                    return;
                }
            }
        }
    }
    if ($modelName === "team_view") {
        // TODO : should not be necessary
        $modelName = "team";
    }
    deleteRow($db, $modelName, $record);
    //deleteRowDynamoDB($modelName, $record);
}
Ejemplo n.º 18
0
/**
 * Delete a meta-template-figure
 * @param integer GUID of the figure
 */
function deleteMetaTemplateFigure($id)
{
    deleteRow("meta", "MTI_ID = {$id}");
    deleteRow("meta_template_items", "MTI_ID = {$id}");
    $id = translateState($id, 10, false);
    deleteRow("meta", "MTI_ID = {$id}");
    deleteRow("meta_template_items", "MTI_ID = {$id}");
}
/**
 * Delete a meta-template-figure
 * @param integer GUID of the figure
 */
function deleteClusterTemplateFigure($id)
{
    deleteRow("cluster_template_items", "CLTI_ID = {$id}");
    $id = translateState($id, 10, false);
    deleteRow("cluster_template_items", "CLTI_ID = {$id}");
}
Ejemplo n.º 20
0
	/**
	 * Launch the clusters in a compound-group
	 * @param integer $in CGID to find clusters from
	 * @param integer ID of the level to launch to.
	 */
	function launchCompoundGroupMembers($in, $level) {
		global $db;
		
		$cgidTrans = translateState($in, $level, false);
		deleteRow("compound_group_members", "CGID = ".$cgidTrans);
		
		$sql = "SELECT * FROM compound_group_members WHERE CGID = $in";
		$query = new query($db, $sql);
		while ($query->getrow()) {
			$position = $query->field("POSITION");
			$cgmid = $query->field("CGMID");
			
			$variations = createDBCArray("cluster_variations", "VARIATION_ID", "CLNID = $cgmid");
			for ($i=0; $i < count($variations); $i++) {
				$cgmidTrans = launchCluster($cgmid, $level, $variation);
			}
			
			$sql = "INSERT INTO compound_group_members (CGID, CGMID, POSITION) VALUES($cgidTrans, $cgmidTrans, $position)";
			$squery = new query($db, $sql);
			$squery->free();
		}
		$query->free();				
	}
Ejemplo n.º 21
0
                $cover = $row['art'];
            }
            //	Add db columns
            $parameters['art'] = basename($cover);
            $parameters['listeners'] = $listenerString;
            //	DB record exists, overwrite
            if ($row) {
                updateRow($parameters);
            } else {
                insertRow($parameters);
            }
            //	Save nowplaying info
            $row = $parameters;
        } else {
            if ($firstPass) {
                echo "Song unchanged from previous run. Updating playback only.\n";
            }
            updatePlayback($parameters['playback_time'], $parameters['paused'], $listenerString);
        }
    } else {
        //	Song was playing on last update
        if (isset($row['title']) && strlen($row['title']) || isset($row[0])) {
            deleteRow();
        }
        //	Reset nowplaying info
        $row = array();
    }
    $firstPass = false;
    $com = null;
    sleep($updateInterval);
}
    //return $sql;
    $result = ibase_query($sql);
    if ($result) {
        return true;
    } else {
        return false;
    }
}
if ($_REQUEST['sender'] == "entri_penetapan_PajakRetribusi") {
    if ($_REQUEST['action'] == 'edit') {
        //edit
        if (isset($_SESSION['delete_box']) && is_array($_SESSION['delete_box'])) {
            //delete process if box is not empty
            foreach ($_SESSION['delete_box']['retribusi_id'] as $key => $id) {
                $params = array('retribusi_id' => $id);
                deleteRow('pendataan_retrubusi', $params);
            }
            //print_r($_SESSION['delete_box']);
            unset($_SESSION['delete_box']);
        }
        if (isset($_REQUEST['detail'])) {
            //data detail
            $id_rekening = getIdRekening($_REQUEST['rekening']);
            if ($x = searchRow('pendataan_retrubusi', 'pendataan_id', $_REQUEST['FK'], $_REQUEST['id'])) {
                //ada id row, update
                //echo $x;
                //$exception = array('nominal','pendataan_id','retribusi_id');
                $exception = array('pendataan_id', 'retribusi_id');
                $other_request = array('dasar_pengenaan' => $_REQUEST['pengenaan'], 'id_rekening' => $id_rekening, 'dasar_tarif' => $_REQUEST['tarif'], 'kode_rekening' => $_REQUEST['rekening'], 'nominal' => $_REQUEST['retribusi']);
                ibase_trans();
                $str_where = " where retribusi_id =" . $_REQUEST['id'];
Ejemplo n.º 23
0
        <link rel="icon" type="image/png" href="favicon-32x32.png" sizes="32x32" />
		<link rel="icon" type="image/png" href="favicon-16x16.png" sizes="16x16" />
    </head>
	<body bgcolor="666666">
	
<!-- Handle POST action / Display result or error -->
	<?php 
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    echo "<table cellpadding=2 width='100%' bgcolor='FFFFFF'><tr><td>\n";
    echo "<font face='arial' color='red'>\n";
    if ($_POST["insert"] == 'Submit') {
        echo insertRow(addslashes($_POST["FortuneText"]));
    } elseif ($_POST["update"] == 'Submit') {
        echo updateRow($_POST["id"], addslashes($_POST["FortuneText"]));
    } elseif ($_POST["delete"] == 'Delete') {
        echo deleteRow($_POST["id"]);
    }
    echo "</font>\n</td></tr></table>";
}
?>
	
	<font face="arial" color="FFFFFF">
		<h1>Devops Fortune Cookie - Database Maintenance </h1>
	</font>
		
	<font face="arial" color="FFFFFF">
		<h2>Current Fortune List</h2> 
	</font>

<!-- Display data table -->
	<font face="arial" color="000000">
    //return $sql;
    $result = ibase_query($sql);
    if ($result) {
        return true;
    } else {
        return false;
    }
}
if ($_REQUEST['sender'] == "entri_penetapan_PajakParkir") {
    if ($_REQUEST['action'] == 'edit') {
        //edit
        if (isset($_SESSION['delete_box'])) {
            //delete process if box is not empty
            foreach ($_SESSION['delete_box']['pparkir_id'] as $key => $id) {
                $params = array('pparkir_id' => $id);
                deleteRow('pendataan_pparkir', $params);
            }
            unset($_SESSION['delete_box']);
            //print_r($_SESSION['delete_box']);
        }
        if (isset($_REQUEST['detail'])) {
            //data detail
            $id_rekening = getIdRekening($_REQUEST['rekening']);
            //$table = 'pendataan_pparkir';
            //$params=array('pendataan_id'=>$_REQUEST['FK'],'pparkir_id'=>$_REQUEST['id']);
            //$separators=array('AND');
            if ($x = searchRow('pendataan_pparkir', 'pendataan_id', $_REQUEST['FK'], $_REQUEST['id'])) {
                //if($x=searchRow($table,$params,$separators) ) {
                //echo $x;
                $exception = array('pparkir_alamat', 'pparkir_id_desa', 'pendataan_id', 'pparkir_id');
                $other_request = array('dasar_pengenaan' => $_REQUEST['pengenaan'], 'persen_tarif' => $_REQUEST['persen'], 'id_rekening' => $id_rekening, 'nominal' => $_REQUEST['pajak']);
Ejemplo n.º 25
0
	/**
	 * Remove a Function from a role
	 *
	 * @param string ID of the Function
	 * @param string Name of the role
	 */
	function removeFunctionFromRole($functionId, $roleName) {
		$functionId = strtoupper($functionId);

		$rlid = getDBCell("roles", "ROLE_ID", "UPPER(ROLE_NAME) = UPPER('$roleName')");
		deleteRow("role_sys_functions", "ROLE_ID = $rlid AND FUNCTION_ID = '$functionId'");
	}