$dbtUpdate['tables'][$dbTable]['cells'][$ri][$ci]['f']['ts'] = $tp[$ri][$ci]['f']['ts'] = strftime("%Y-%m-%d %H:%M:%S"); $dbtUpdate['tables'][$dbTable]['cells'][$ri][$ci]['f']['oid'] = $tp[$ri][$ci]['f']['oid'] = $_SESSION['oid']; $sciri = $ci . "," . ($ri != 'tHR' ? $cpid = $liveDBTable['cells'][$ri][$liveDBTable['priCol']]['innerHTML'] : ""); //Add or remove changed effective element from changed src elements /**/ for ($i = 0; $i < count($pSCs); $i++) { $c = explode(",", $pSCs[$i]); if (!$c[2]) { $aPSCs[$dbTable][] = $c; } else { $aPSCs[$c[2]][] = $c; } } putTableInFile($tp, $dbTable); closeLiveTable($dbTable, $liveDBTable); $sCs = computeSourceCells($f, $dbTable, $ci, $ri, $cpid, $aPSCs, $sciri, $dbtUpdate); $liveDBTable = getLiveTable($dbTable); $tp = getTableFromFile($dbTable); $dbtUpdate['tables'][$dbTable]['cells'][$ri][$ci]['f']['sCs'] = $tp[$ri][$ci]['f']['sCs'] = $sCs; $sua = array(); if ($ri == 'tHR') { foreach ($tp as $rid => $row) { if (count($tp[$rid][$ci]['style']) > 2) { unset($tp[$rid][$ci]['style']['ts']); unset($tp[$rid][$ci]['style']['oid']); foreach ($tp[$rid][$ci]['style'] as $prop => $value) { $sua[$rid][$ci]['style'][$prop] = $value; } $dbtUpdate['tables'][$dbTable]['cells'][$rid][$ci]['style'] = $tp[$rid][$ci]['style'] = array(); $dbtUpdate['tables'][$dbTable]['cells'][$rid][$ci]['style']['ts'] = $tp[$rid][$ci]['style']['ts'] = strftime("%Y-%m-%d %H:%M:%S"); $dbtUpdate['tables'][$dbTable]['cells'][$rid][$ci]['style']['oid'] = $tp[$rid][$ci]['style']['oid'] = $_SESSION['oid'];
require '../adminScripts/db_login.php'; } } $tableOps = explode("\$,\$", $_POST['tableOperation']); for ($toc = 0; $toc < count($tableOps); $toc++) { $tableOperation = $tableOps[$toc]; echo "<" . $tableOperation . ">"; switch ($tableOperation) { case 'updateFormula': $ci = $_POST['fColIndex']; $ri = $_POST['fRowIndex']; $fsKey = $_POST['fsKey']; if ($authorizeTable or $_SESSION['tables'][$dbTable][$ci][$ri]['sKey'] and $_SESSION['tables'][$dbTable][$ci][$ri]['sKey'] == $fsKey) { $f = $_POST['formula']; if (strlen($f) < 1000) { $sCs = computeSourceCells($f, $dbTable, $ri); $fn = "{$root}/dbTableData/{$dbTable}"; $fp = fopen($fn, 'a+'); $tp = fread($fp, filesize($fn)); fclose($fp); $tp = json_decode($tp, TRUE); unset($tp[$ri][$ci]['style']['oid']); unset($tp[$ri][$ci]['style']['ts']); foreach ($tp[$ri][$ci] as $prop => $value) { $sua[$ri][$ci]['style'][$prop] = $value; } $tp[$ri][$ci]['style']['oid'] = $_SESSION['oid']; $tp[$ri][$ci]['style']['ts'] = strftime("%Y-%m-%d %H:%M:%S"); $tp[$ri][$ci]['f']['f'] = $f; $pSCs = $tp[$ri][$ci]['f']['sCs']; $tp[$ri][$ci]['f']['sCs'] = $sCs;