示例#1
0
function working($dd)
{
    //echo "stringstringstringstringstringstringstringstring";
    //var_dump($dd);
    $total = json_decode($dd, 1);
    if ($total['order'] == 'Insert') {
        if ($total['type'] == 'TEACHER') {
            //////////
            AddTEACHER($total['data']);
        } else {
            if ($total['type'] == 'CLASS') {
                ///////////////
                AddCLASS($total['data']);
            } else {
                if ($total['type'] == 'IN') {
                    AddIN($total['data']);
                } else {
                    if ($total['type'] == 'OUT') {
                        AddOUT($total['data']);
                    } else {
                        if ($total['type'] == 'USER') {
                            ///////////////////
                            AddUSER($total['data']);
                        } else {
                            if ($total['type'] == 'ROLE') {
                                ///////////////
                                AddRole($total['data']);
                            } else {
                                if ($total['type'] == 'SUP') {
                                    AddSupplier($total['data']);
                                } else {
                                    if ($total['type'] == 'CUS') {
                                        AddCustomer($total['data']);
                                    } else {
                                        if ($total['type'] == 'CAT') {
                                            AddCategory($total['data']);
                                        } else {
                                            if ($total['type'] == 'UNIT') {
                                                AddUnit($total['data']);
                                            } else {
                                                if ($total['type'] == 'SKU') {
                                                    AddSKU($total['data']);
                                                } else {
                                                    if ($total['type'] == 'DEPT') {
                                                        AddDepartment($total['data']);
                                                    } else {
                                                        if ($total['type'] == 'TRANSFER') {
                                                            AddTRANSFER($total['data']);
                                                        } else {
                                                            echo "<<< DATA CAN'T BE INSERTED Please send an existing type!!! >>>";
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    } else {
        if ($total['order'] == 'Fetch') {
            if ($total['type'] == 'PRICE') {
                FetchPrice($total['data']);
            } else {
                if ($total['type'] == 'INV') {
                    FetchItemINV($total['data']);
                } else {
                    if ($total['type'] == 'WH') {
                        FetchItemWH($total['data']);
                    } else {
                        if ($total['type'] == 'USER') {
                            FetchItemUser($total['data']);
                        } else {
                            if ($total['type'] == 'STOCK') {
                                //var_dump($total['data']);
                                FetchStock($total['data']);
                            } else {
                                if ($total['type'] == 'SUP') {
                                    ItemSupplier($total['data']);
                                } else {
                                    echo "<<< DATA CAN'T BE INSERTED Please send an existing type!!! >>>";
                                }
                            }
                        }
                    }
                }
            }
        } else {
            if ($total['order'] == 'Delete') {
                if ($total['type'] == 'INV') {
                    DeleteINV($total['data']);
                } else {
                    if ($total['type'] == 'WH') {
                        DeleteWH($total['data']);
                    } else {
                        if ($total['type'] == 'USER') {
                            DeleteUser($total['data']);
                        } else {
                            echo "<<< DATA CAN'T BE INSERTED Please send an existing type!!! >>>";
                        }
                    }
                }
            } else {
                if ($total['order'] == 'Update') {
                    if ($total['type'] == 'INV') {
                        UpdateINV($total['data']);
                    } else {
                        if ($total['type'] == 'WH') {
                            UpdateWH($total['data']);
                        } else {
                            if ($total['type'] == 'USER') {
                                UpdateUser($total['data']);
                            } else {
                                echo "<<< DATA CAN'T BE INSERTED Please send an existing type!!! >>>";
                            }
                        }
                    }
                } else {
                    if ($total['order'] == 'FetchAllNames') {
                        if ($total['type'] == 'ROLE') {
                            ///////////////////
                            FetchAllNamesROLE();
                        }
                        if ($total['type'] == 'CAT') {
                            FetchAllNamesCAT();
                        }
                        if ($total['type'] == 'UNIT') {
                            FetchAllNamesUNIT();
                        }
                        if ($total['type'] == 'PACk') {
                            FetchAllNamesPACK();
                        }
                        if ($total['type'] == 'INV_TYPE') {
                            FetchAllNamesINV_TYPE();
                        }
                        if ($total['type'] == 'CUS') {
                            FetchAllNamesCUS();
                        }
                        if ($total['type'] == 'SUP') {
                            FetchAllNamesSUP();
                        }
                        if ($total['type'] == 'DEPT') {
                            FetchAllNamesDEPT();
                        }
                    } else {
                        if ($total['order'] == 'FetchAllIds') {
                            if ($total['type'] == 'ROLE') {
                                ////////////////////
                                FetchAllIdsROLE();
                            }
                            if ($total['type'] == 'RM') {
                                FetchAllIdsRM();
                            }
                            if ($total['type'] == 'INV') {
                                FetchAllIdsINV();
                            }
                            if ($total['type'] == 'INV_TYPE') {
                                FetchAllIdsInvType();
                            }
                            if ($total['type'] == 'PACK') {
                                FetchAllIdsPACK();
                            }
                            if ($total['type'] == 'SUP') {
                                FetchAllIdsSUP();
                            }
                            if ($total['type'] == 'CUS') {
                                FetchAllIdsCUS();
                            }
                            if ($total['type'] == 'DEPT') {
                                FetchAllIdsDEPT();
                            }
                        } else {
                            if ($total['order'] == 'FetchAllAdmins') {
                                FetchAllAdmins();
                            } else {
                                if ($total['order'] == 'List') {
                                    if ($total['type'] == 'INV') {
                                        ListINV();
                                    } else {
                                        if ($total['type'] == 'USER') {
                                            ListUser();
                                        } else {
                                            if ($total['type'] == 'STOCK') {
                                                ListStock();
                                            } else {
                                                if ($total['type'] == 'WH') {
                                                    ListWH();
                                                } else {
                                                    if ($total['type'] == 'INV_WH') {
                                                        ListINV_WH($total['data']);
                                                    } else {
                                                        if ($total['type'] == 'WH_INV') {
                                                            ListWH_INV($total['data']);
                                                        } else {
                                                            if ($total['type'] == 'SUP') {
                                                                ListSUP($total['data']);
                                                            } else {
                                                                if ($total['type'] == 'INV_SUP') {
                                                                    ListINV_SUP($total['data']);
                                                                } else {
                                                                    if ($total['type'] == 'SUP_INV') {
                                                                        ListSUP_INV($total['data']);
                                                                    } else {
                                                                        if ($total['type'] == 'BINS') {
                                                                            ListBINS($total['data']);
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                } else {
                                    if ($total['order'] == 'Value') {
                                        if ($total['type'] == 'WH') {
                                            ValueWH($total['data']);
                                        } else {
                                            if ($total['type'] == 'INV') {
                                                ValueINV($total['data']);
                                            }
                                        }
                                    } else {
                                        if ($total['order'] == 'Test') {
                                            if ($total['type'] == 'DATE') {
                                                TestDate();
                                            } else {
                                                if ($total['type'] == 'BIN') {
                                                    BinMap($total['data']);
                                                } else {
                                                    if ($total['type'] == 'ItemLevel') {
                                                        ItemLevel($total['data']);
                                                    }
                                                }
                                            }
                                        } else {
                                            if ($total['order'] == 'FetchId') {
                                                if ($total['type'] == 'WH') {
                                                    FetchIDWH($total['data']);
                                                }
                                                if ($total['type'] == 'CAT') {
                                                    FetchIDCAT($total['data']);
                                                }
                                                if ($total['type'] == 'UNIT') {
                                                    FetchIDUNIT($total['data']);
                                                }
                                                if ($total['type'] == 'ROLE') {
                                                    ///////////////////
                                                    FetchIDROLE($total['data']);
                                                }
                                                if ($total['type'] == 'INV_TYPE') {
                                                    FetchIDINV_TYPE($total['data']);
                                                }
                                                if ($total['type'] == 'SUP') {
                                                    FetchIDSUP($total['data']);
                                                }
                                                if ($total['type'] == 'PACK') {
                                                    FetchIDPACK($total['data']);
                                                }
                                                if ($total['type'] == 'CUS') {
                                                    FetchIDCUS($total['data']);
                                                }
                                                if ($total['type'] == 'DEPT') {
                                                    FetchIDDEPT($total['data']);
                                                }
                                            } elseif ($total['order'] == 'login') {
                                                $recivedArray = $total['data'];
                                                //echo "stringstringstringstringstringstringstringstringstringstringstringstringstringstringstringstring";
                                                login($recivedArray['username'], $recivedArray['password']);
                                            } else {
                                                if ($total['order'] == 'logout') {
                                                    //echo "Logout";
                                                    logout1();
                                                } else {
                                                    if ($total['order'] == 'authenticate') {
                                                        authenticate();
                                                    } else {
                                                        //Not Logged In Case OR Not Have required Privliges{
                                                        response("OK", 'fail', array('alertBox' => "Please Login First !"));
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
示例#2
0
    $tpl->parseCurrentBlock("back_unit");
    $projectId = GetProjectIdForUnit($_POST["unit_id"]);
} else {
    $tpl->setCurrentBlock("back_project");
    $tpl->setVariable("PROJECT_ID", $_POST["project_id"]);
    $tpl->parseCurrentBlock("back_project");
    $projectId = $_POST["project_id"];
}
$isLogged = IsLogged();
// If user is logged in and had write access, we directly update the database
if ($isLogged && IsWriter($projectId)) {
    // if we have a unit_id, we update, else we add
    if (array_key_exists("unit_id", $_POST) && $_POST["unit_id"] != "") {
        $msg = ModifyUnit($_POST["unit_id"], str_replace(".pas", ".dtx", $_POST["unit_name"]), $_POST["description"], $_POST["author"], $_POST["package"], $_POST["status"], GetLoggedUserId());
    } else {
        $msg = AddUnit(str_replace(".pas", ".dtx", $_POST["unit_name"]), $_POST["description"], $_POST["author"], $_POST["package"], $_POST["status"], $_POST["project_id"], GetLoggedUserId());
        if (is_numeric($msg)) {
            $msg = "";
        }
    }
    $tpl->setCurrentBlock("thanks_logged_in");
    $tpl->touchBlock("thanks_logged_in");
    $tpl->parseCurrentBlock("thanks_logged_in");
} else {
    /*    // if the user is not logged in or does not have write access, 
        // we submit the item for review
        $msg = AddSubmittedItem(
                 $_POST["item_id"], 
                 $_POST["unit_id"], 
                 $_POST["name"], $_POST["summary"], $_POST["description"], 
                 $_POST["return_value"], $_POST["see_also_list"], $_POST["parameters"],
示例#3
0
function ProcessDtx($filename, $projectId)
{
    StartAccessToDB();
    $lines = file($filename);
    $msg = "processing " . $filename . "<br>";
    $unitname = basename($filename);
    // Delete the existing unit (if any)
    $msg .= "deleting previous values for {$unitname}, if any...<br>";
    $deleteResult = DeleteUnitAndItemsByUnitName($unitname);
    if ($deleteResult != "") {
        $msg .= "Error while removing previous values: " . $deleteResult;
    } else {
        $msg .= "Success<br>";
        $unitId = -1;
        $index = 0;
        while ($index < count($lines)) {
            $curline = rtrim($lines[$index]);
            if (HasPrefix($curline, '##Package:')) {
                $package = substr($curline, strpos($curline, ':') + 2);
                $msg .= "found package: {$package}<br>";
            }
            if (HasPrefix($curline, '##Status:')) {
                $status = substr($curline, strpos($curline, ':') + 2);
                $msg .= "found status: {$status}<br>";
            }
            if (HasPrefix($curline, '@@')) {
                $msg .= "found item: {$curline} - ";
                if ($unitId == -1) {
                    $msg .= "Adding unit <a href=\"unit.php?Name={$unitname}\">{$unitname}</a> - ";
                    $unitId = AddUnit($unitname, "", "", $package, $status, $projectId, GetLoggedUserId());
                    if (is_string($unitId)) {
                        $msg .= $unitId . "<br>";
                        $unitId = -1;
                    }
                }
                if ($unitId != -1) {
                    $msg .= ProcessItem($lines, $index, $unitId);
                }
            }
            $index++;
        }
    }
    // delete the file, we don't need it anymore
    unlink($filename);
    EndAccessToDB();
    return $msg;
}