Example #1
0
 /**
  * @rest
  * @conn    vfs
  * @argv    vfs_groups    {"copy": ["GRP"]}
  * @env
  */
 public function PUT($conn, $argv, $_env)
 {
     if (!isset($argv["ENDDA"])) {
         $argv["ENDDA"] = DB::constant("NULL");
     }
     try {
         $conn->begin();
         $conn->update($conn->vfs_groups($argv)->slice("GRP"));
         $conn->commit();
         $_env->push($this->msg[__FUNCTION__], $this->res);
     } catch (Exception $e) {
         $conn->rollback();
         $_env = $e->getMessage();
     }
     return $_env;
 }
Example #2
0
 public function __construct()
 {
     $this->argv = array("PER" => date("Ymd"), "USR" => isset($_SESSION["USR"]) ? $_SESSION["USR"] : "******", "ADDR" => HTTP_CLIENT_IP, "NAMESPACE" => null, "MSG" => null, "LOGTIME" => DB::constant("CURRENT_TIMESTAMP"));
 }
Example #3
0
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @author  wilaheng@gmail.com
 */
if (!defined("ENV")) {
    die("Undefined_ENV_Exception");
}
if (sizeof($_SERVER["argv"]) > 1) {
    $conn = DB::lookup("vfs");
    try {
        $conn->begin();
        $methodName = inf()->execute;
        $execTime = DB::constant("CURRENT_TIMESTAMP");
        for ($i = 1, $j = sizeof($_SERVER["argv"]); $i < $j; $i++) {
            $className = $_SERVER["argv"][$i];
            $logMessage = Service::get($className, $methodName)->getInstance()->{$methodName}();
            $conn->vfs_crons_logs(array("CMD" => $className, "LOG_MESSAGE" => $logMessage, "EXEC_TIME" => $execTime))->insert();
        }
        $conn->commit();
    } catch (Exception $e) {
        $conn->rollback();
        dbg()->log(NS_ERROR, $e->getMessage());
    }
}
Example #4
0
 /**
  * @rest
  * @conn    vfs
  * @argv    vfs_users    {"copy": ["USR"], "slice": ["PWD", "C_USER", "C_DATE", "U_USER", "U_DATE"], "push": ["PWD", {"req": false}], "push": ["PWD_CONFIRM", {"req": false}]}
  * @env
  */
 public function PUT($conn, $argv, $_env)
 {
     if (isset($argv["PWD"])) {
         $message = "INVALID PASSWORD CONFIRM";
         if (!isset($argv["PWD_CONFIRM"])) {
             return $message;
         }
         if ($argv["PWD"] !== $argv["PWD_CONFIRM"]) {
             return $message;
         }
         $argv["PWD"] = md5($argv["PWD_CONFIRM"]);
         $argv["EXP"] = isset($argv["F2CPWD"]) ? DB::constant("CURRENT_DATE") : date("Y-m-d", time() + 60 * 60 * 24 * 30 * 3);
     }
     if (isset($argv["PWD_CONFIRM"])) {
         unset($argv["PWD_CONFIRM"]);
     }
     // no copy
     $argv["U_DATE"] = DB::constant("CURRENT_TIMESTAMP");
     $argv["U_USER"] = $_SESSION["USR"];
     if (!isset($argv["ENDDA"])) {
         $argv["ENDDA"] = DB::constant("NULL");
     }
     $conn = DB::lookup("vfs");
     try {
         $conn->begin();
         $conn->update($conn->vfs_users($argv)->slice("USR"));
         $conn->executeUpdate("DELETE FROM vfs_groups_users WHERE USR='******'", $argv["USR"]);
         if (!isset($_SESSION["vfs_forms_Users_Group"][1100])) {
             $_SESSION["vfs_forms_Users_Group"][1100] = "Kypass";
         }
         foreach ($_SESSION["vfs_forms_Users_Group"] as $GRP => $GRP_NAME) {
             $conn->executeUpdate("INSERT INTO vfs_groups_users (`USR`, `GRP`) VALUES ('%s', '%s')", $argv["USR"], $GRP);
         }
         $conn->commit();
         $_env->warn("DATA BERHASIL DIUPDATE");
         $this->CLEAR();
     } catch (Exception $e) {
         $conn->rollback();
         $_env = $e->getMessage();
     }
     return $_env;
 }