if (isset($_FILES[$table])) { $FILE = $_FILES[$table]; foreach ($FILE as $property => $nam) { $keyN = array_keys($nam); $keyN = $keyN[0]; $TempFILE[$keyN][$property] = $FILE[$property][$keyN]; } $FILE = $TempFILE; if (array_key_exists('image_id', $FILE)) { if ($FILE['image_id']['tmp_name'] != '') { $dataImage = array(); $dataTmp = array(); if ($dataTmp['name'] = $image->uploadImage($FILE, 'image_id')) { if ($image->masterImage($dataTmp)) { $dataImage['name'] = $dataTmp['name']; $data['image_id'] = $index->addGeneralItem($dataImage, 'image'); $images_added[$table] = $data['image_id']; } } } } } //$index->show($data); $itemExist = $index->checkGeneralItemIfExist($id = '', $data, $table); if ($itemExist) { $tablesData[$table] = "exists"; $existData[$table] = $itemExist; //************************* delete images that has bees uploaded ****** /*if(count($images_added)) { foreach($images_added as $Dtable=>$Did)
$data['content_code'] = $data['content_code'] . '</ul>'; } //**************************** save table as html ******************************** //$index->show($data);die(); if (isset($_FILES)) { if ($_FILES['file']['error']) { die('File Error'); } if (array_key_exists('image_id', $_FILES)) { if ($_FILES['image_id']['tmp_name'] != '') { $dataImage = array(); $dataTmp = array(); if ($dataTmp['name'] = $image->uploadImage($_FILES, 'image_id')) { if ($image->masterImage($dataTmp)) { $dataImage['name'] = $dataTmp['name']; $data['image_id'] = $index->addGeneralItem($dataImage, 'image'); } } } } //**************************************************************************************** //$index->show($_FILES); if (array_key_exists('file', $_FILES)) { if ($_FILES['file']['tmp_name'] != '') { //************ verify file type *********** if (isset($_POST['control_p_file_type_id'])) { $validType = false; $fileType = $index->getGeneralItemById($_POST['control_p_file_type_id'], 'control_p_file_type'); $fileType = $fileType[$_POST['control_p_file_type_id']]; $extA = explode(' ', $fileType['extentions']); foreach ($extA as $ind => $ext) {
if (array_key_exists('image_id', $_FILES)) { if ($_FILES['image_id']['tmp_name'] != '') { $dataImage = array(); $dataTmp = array(); if ($dataTmp['name'] = $image->uploadImage($_FILES, 'image_id')) { if ($image->masterImage($dataTmp)) { $dataImage['name'] = $dataTmp['name']; $item = $index->getGeneralItemById($id, $table); $idImage = $item[$id]['image_id']; $imgItem = $index->getGeneralItemById($idImage, 'image'); $oldImage = $imgItem[$idImage]['name']; if ($idImage != '0') { $index->editGeneralItem($idImage, $dataImage, 'image'); $image->deleteImageFile($oldImage); } else { $data['image_id'] = $index->addGeneralItem($dataImage, 'image'); } } } } } } //******************************************* END IN CASE THERE IS IMAGE ***************************************** if (isset($_GET['newLang'])) { if (false) { } else { $itemEdited = $index->editGeneralItemNewLang($id, $data, $table); if ($itemEdited) { header('Location: ../../index/edit' . $Table . '.php?id=' . $id . '¬e=' . $index->toView($Table) . ' New Language Added'); } else { if (strpos(mysql_error(), 'Duplicate entry') === false) {
$cnct = new cnct_class(); $cnx = $cnct->cnct(); $index_data['cnx'] = $cnx; $index = new index($index_data); $ip = $_SERVER['REMOTE_ADDR']; $user_agent = $_SERVER['HTTP_USER_AGENT']; //$index->show($_POST); $_POST['cnx'] = $cnx; if ($info = $user->login($_POST)) { $info['ip'] = $ip; $info['user_agent'] = $user_agent; $info['online'] = 'Yes'; $info['start_date'] = date("F j, Y, g:i a"); $info['end_date'] = 'PENDING'; //var_dump($info); die(); if ($id = $index->addGeneralItem($info, $table = 'control_p_login', $cnx)) { if (isset($info['username'])) { $_SESSION['username'] = $info['username']; } else { $_SESSION['email'] = $info['email']; } $_SESSION['control_p_group_id'] = $info['control_p_group_id']; $_SESSION['control_p_login_id'] = $id; $_SESSION['id'] = $info['control_p_admin']; $_SESSION['lang'] = '1'; ?> <script language="javascript" > window.location='../../index/index.php'; </script> <?php //$index->show($_SESSION);
$cols = $index->getGeneralColums($table); $PRI = $cols['primaryKeys']; $PRI = $PRI[0]; $oldData = array(); foreach ($old as $key3 => $val3) { $oldData[$key3] = $val3[$PRI]; } if ($index->deleteGeneralItems($oldData, $table)) { $newData[$PT1 . '_id'] = $_POST[$PT1 . '_id']; //setting the new data would be added to the table. this represents the selected item to be edited //var_dump($old);die(); foreach ($_POST[$PT2] as $key2 => $val) { $newData[$PT2 . '_id'] = $val; //setting the new data would be added to the table. this represents the checked sub-item that is assigned to be item edited //var_dump($newData);die(); if (!$index->addGeneralItem($newData, $table)) { $result = false; break; } else { $result = true; } } if ($result) { header('Location: ../../index/' . $table . '.php?note=' . $index->toView($Table) . ' Edited'); } else { header('Location: ../../index/' . $table . '.php?note=' . $index->toView($table) . ' Not Edited,Please Try Again'); } } else { header('Location: ../../index/' . $table . '.php?note=' . $index->toView($Table) . ' Not Edited,Please Try Again'); } //var_dump($oldData);die();