function pay()
 {
     $id = addslashes($_GET['app_id']);
     $acc = new App2Acc();
     $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id AND ac_app_id = '{$id}' ", array("AppAccount"));
     if (count($apps) < 1) {
         die("hacking attempt");
     } else {
         $app = $apps[0];
     }
     $paket = new Paket();
     $paket->getByID($app->app_paket_id);
     $dibayarkan = $paket->paket_price * 12;
     //veritrans config
     Veritrans_Config::$serverKey = self::$serverKey;
     $transaction_details = array('order_id' => rand(), 'gross_amount' => $dibayarkan);
     $item1_details = array('id' => $app->app_id, 'price' => $dibayarkan, 'quantity' => 1, 'name' => "Payment for " . $app->app_name);
     $item_details = array($item1_details);
     $ac = Account::getAccountObject();
     $exp = explode(" ", Account::getMyName());
     $lastname = array_pop($exp);
     $billing_address = array('first_name' => implode(" ", $exp), 'last_name' => $lastname, 'address' => "Mangga 20", 'city' => "Jakarta", 'postal_code' => "16602", 'phone' => "081122334455", 'country_code' => 'IDN');
     $customer_details = array('first_name' => implode(" ", $exp), 'last_name' => $lastname, 'email' => $ac->admin_email, 'phone' => "081122334455", 'billing_address' => $billing_address);
     $transaction = array('transaction_details' => $transaction_details, 'customer_details' => $customer_details, 'item_details' => $item_details);
     try {
         // Redirect to Veritrans VTWeb page
         header('Location: ' . Veritrans_VtWeb::getRedirectionUrl($transaction));
     } catch (Exception $e) {
         echo $e->getMessage();
         if (strpos($e->getMessage(), "Access denied due to unauthorized")) {
             echo "<code>";
             echo "<h4>Please set real server key from sandbox</h4>";
             echo "In file: " . __FILE__;
             echo "<br>";
             echo "<br>";
             echo htmlspecialchars('Veritrans_Config::$serverKey = \'<your server key>\';');
             die;
         }
     }
 }
    function extend()
    {
        $id = addslashes($_GET['app_id']);
        $acc = new App2Acc();
        $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id AND ac_app_id = '{$id}' ", array("AppAccount"));
        if (count($apps) < 1) {
            die("hacking attempt");
        } else {
            $app = $apps[0];
        }
        if ($app->app_active < 1) {
            header("Location:" . _SPPATH . "myapps");
            die;
        }
        if ($app->app_paket_id < 2) {
            die("Paket bukan paket PAID");
        }
        $prevPaket = new Paket();
        $prevPaket->getByID($app->app_paket_id);
        AppAccount::checkOwnership($app);
        $paket = new Paket();
        $arrPaket = $paket->getWhere("paket_active = 1 AND paket_id > 1 ORDER BY paket_id ASC");
        $paket2 = new Paket();
        $paket2->getByID(2);
        $paket1 = new Paket();
        $paket1->getByID(3);
        $next = 3;
        ?>
        <div class="container attop" style="text-align: center;" >
        <div class="col-md-8 col-md-offset-2">
    <div class="appear_logo_pages">
        <a href="<?php 
        echo _SPPATH;
        ?>
">
            <img src="<?php 
        echo _SPPATH;
        ?>
images/appear-payment.png" >
        </a>
    </div>

        <div class="app" style="background-color: #dedede;">
            <div style="background-color: #cccccc; padding: 5px; text-align: center; font-size: 15px;">
                Previous Package : <?php 
        echo $prevPaket->paket_name;
        ?>
<br>
                Contract End : <?php 
        echo date("d-m-Y", strtotime($app->app_contract_end));
        ?>
 in <?php 
        echo dateDifference(date("Y-m-d", strtotime($app->app_contract_end)), date("Y-m-d"));
        ?>
 days
            </div>

            <div style="background-color: #f6f6f6; padding: 5px; text-align: center; font-size: 20px;">Payment For</div>
            <div class="col-md-3 " style="text-align: center; min-height: 270px;  padding: 10px; background-color: #FFFFFF;">
                <b >App Details</b><br><br>
                <img src="<?php 
        echo $app->app_icon;
        ?>
" width="80%"><br>
                <?php 
        echo $app->app_name;
        ?>
            </div>
            <div class="col-md-9 " style="text-align: center; padding: 10px;background-color: #dedede;">
                <div style="padding-bottom: 20px; font-weight: bold;">Package Details</div>
                <div class="clearfix"></div>
                <?php 
        if ($app->app_paket_id != 5) {
            ?>
                <div class="col-md-6 col-sm-6 col-xs-6">
                    <img style="cursor: pointer;" id="paket1" onclick="setPaket(1);" src="<?php 
            echo _SPPATH;
            ?>
images/paket-android-ios.png" width="100%">
                    <small>what you get</small>
                </div>
                <?php 
        } else {
            $paket1 = new Paket();
            $paket1->getByID(5);
            $next = 5;
            ?>
                    <div class="col-md-6 col-sm-6 col-xs-6">
                        <img style="cursor: pointer;" id="paket1" onclick="setPaket(1);" src="<?php 
            echo _SPPATH;
            ?>
images/paket-android-ios.png" width="100%">
                        <small>what you get</small>
                    </div>
                <?php 
        }
        ?>
                <?php 
        if ($app->app_paket_id == 2) {
            ?>
                <div class="col-md-6 col-sm-6 col-xs-6">
                    <img style="cursor: pointer;" id="paket2" onclick="setPaket(2);" src="<?php 
            echo _SPPATH;
            ?>
images/paket-android-2.png"  width="100%">
                    <small>what you get</small>
                </div>
                <?php 
        }
        ?>

                <div class="clearfix"></div>
                <script>
                    var paket_selected = 3;
                    function setPaket(x){
                        if(x == 1){
                            $('#paket2').attr("src","<?php 
        echo _SPPATH;
        ?>
images/paket-android-2.png");
                            $('#paket1').attr("src","<?php 
        echo _SPPATH;
        ?>
images/paket-android-ios.png");
                            $('#paketprice').html("IDR <?php 
        echo idr($paket1->paket_price);
        ?>
 / year");
                            paket_selected = 3;
                            $('#paybuttonpaket3').show();
                            $('#paybuttonpaket2').hide();
                        }else{
                            $('#paket2').attr("src","<?php 
        echo _SPPATH;
        ?>
images/paket-android.png");
                            $('#paket1').attr("src","<?php 
        echo _SPPATH;
        ?>
images/paket-android-ios-2.png");
                            $('#paketprice').html("IDR <?php 
        echo idr($paket2->paket_price);
        ?>
 / year");
                            paket_selected = 2;
                            $('#paybuttonpaket2').show();
                            $('#paybuttonpaket3').hide();
                        }
                    }
                </script>
            </div>
            <div class="clearfix"></div>
            <div id="paketprice" style="background-color: #f6f6f6; padding: 5px; text-align: center; font-size: 30px;">IDR <?php 
        echo idr($paket1->paket_price);
        ?>
 / year</div>
            <div style="background-color: #cccccc; padding: 5px; text-align: center; font-size: 15px;">

                This will renew the contract until <?php 
        echo date("d-m-Y", strtotime($app->app_contract_end . " + 1 year"));
        ?>
            </div>
        </div>

        <div style="padding: 20px;">
            <a id="paybuttonpaket3" href="<?php 
        echo _SPPATH;
        ?>
Vp/pay?app_id=<?php 
        echo $app->app_id;
        ?>
&paket=<?php 
        echo $next;
        ?>
" class="btn btn-danger btn-lg">PAY NOW USING VERITRANS</a>
            <a id="paybuttonpaket2" style="display: none;" href="<?php 
        echo _SPPATH;
        ?>
Vp/pay?app_id=<?php 
        echo $app->app_id;
        ?>
&paket=2" class="btn btn-danger btn-lg">PAY NOW USING VERITRANS</a>

            <!--            <a href="--><?php 
        //=_SPPATH;
        ?>
<!--VeritransPay/pay?app_id=--><?php 
        //=$app->app_id;
        ?>
<!--" class="btn btn-danger btn-lg">PAY NOW USING VERITRANS</a>-->
        </div>


        <hr>
        <div style="text-align: center; margin-bottom: 100px;">
            <a href="<?php 
        echo _SPPATH;
        ?>
myapps">I will finish the payment later. Go back to My Apps.</a>
        </div>


    <?php 
    }
Exemplo n.º 3
0
 function setID()
 {
     if (in_array("master_admin", Account::getMyRoles())) {
         $acc = new AppAccount();
         $apps = $acc->getAll();
         //
     } else {
         $acc = new App2Acc();
         $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id AND app_active = 1", array("AppAccount"));
     }
     $arrApp = array();
     foreach ($apps as $ap) {
         $semua[] = $ap->app_id;
         $arrApp[$ap->app_id] = $ap;
     }
     if (in_array($_GET['app_id'], $semua)) {
         //ok
         $_SESSION['app_active'] = $arrApp[$_GET['app_id']];
         $_SESSION['app_id'] = addslashes($_GET['app_id']);
         header("Location:" . _SPPATH . "PushHome/home?st=Balance");
         die;
     } else {
         //not ok
         die("hacking attempt");
     }
 }
    function confirmpayment()
    {
        $id = addslashes($_GET['app_id']);
        $acc = new App2Acc();
        $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id AND ac_app_id = '{$id}' ", array("AppAccount"));
        if (count($apps) < 1) {
            die("hacking attempt");
        } else {
            $app = $apps[0];
        }
        $paket = new Paket();
        $paket->getByID($app->app_paket_id);
        ?>
        <style>
            .helper{
                font-size: 12px;
                padding-top: 5px;
                color:#999999;
            }
            .foto100{
                width: 100px;
                height: 100px;
                overflow: hidden;
            }
            .foto100 img{
                height: 100px;
            }
            .err{
                display: none;
            }
        </style>
<div class="container attop" style="text-align: center;" >
    <div class="col-md-8 col-md-offset-2">
        <h1>Payment Confirmation for <?php 
        echo $app->app_name;
        ?>
</h1>
        <hr>
        <div id="resultajax" style="display: none;"></div>
        <form id="paymentconfirm" class="form-horizontal" role="form">
            <input type="hidden" name="appid" value="<?php 
        echo $app->app_id;
        ?>
">
            <div class="form-group">
                <label class="control-label col-sm-4" for="ttdate">Date :
                    <div class="helper">max 30 chars</div>
                </label>
                <div class="col-sm-8">
                    <input name="ttdate" type="date" class="form-control" id="ttdate" >
                    <div class="err"></div>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-4" for="ttname">Sender Name :
                    <div class="helper">max 80 chars</div>
                </label>
                <div class="col-sm-8">
                    <input name="ttname" type="text" class="form-control" id="ttname" >
                    <div class="err"></div>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-4" for="ttamount">Amount Transfered :
                    <div class="helper">max 80 chars</div>
                </label>
                <div class="col-sm-8">
                    <input name="ttamount" type="number" class="form-control" id="ttamount" value="<?php 
        echo $paket->paket_price * 12;
        ?>
" >
                    <div class="err"></div>
                </div>
            </div>

            <div class="form-group">
                <label class="control-label col-sm-4" for="ttto">Payment To :
                    <div class="helper">max 80 chars</div>
                </label>
                <div class="col-sm-8">
                    <select id="ttto" name="ttto" class="form-control">
                        <option value="bca">BCA</option>
                        <option value="permata">Permata</option>
                    </select>
                    <div class="err"></div>
                </div>
            </div>
            <div class="form-group">
                <label class="control-label col-sm-4" for="appicon">Receipt File:
                    <div class="helper">optional</div>
                </label>
                <div class="col-sm-8">
                    <?php 
        $foto = new \Leap\View\InputFoto("ttfile", "ttfile", "");
        $foto->p();
        ?>

                 </div>
            </div>
            <div class="form-group">
                <div class="col-sm-8 col-sm-offset-2">
                    <button type="submit" style="width: 100%;" class="btn btn-lg btn-success">Submit</button>
                    <a href="<?php 
        echo _SPPATH;
        ?>
PaymentWeb/payfor?app_id=<?php 
        echo $app->app_id;
        ?>
" style="width: 100%; margin-top: 10px;" class="btn btn-lg btn-default">Cancel</a>
                </div>
            </div>
        </form>
        </div>
    </div>
        <script>
            $( "#paymentconfirm" ).submit(function( event ) {

                $(".err").hide();

//                        alert("benar semua1");
                var $form = $(this);
                var url = "<?php 
        echo _SPPATH;
        ?>
PaymentWeb/addConfirm";

                $(".err").hide();

                // Send the data using post
                var posting = $.post(url, $form.serialize(), function (data) {
                    console.log(data);
                    if (data.bool) {
                        //kalau success masuk ke check your email....
                        document.location = "<?php 
        echo _SPPATH;
        ?>
myOrders";
                    }
                    else {
                        if(data.all!="") {
                            $("#resultajax").show();
                            $("#resultajax").html(data.all);
                        }
                        var obj = data.err;
                        var tim = data.timeId;
                        //console.log( obj );
                        for (var property in obj) {
                            if (obj.hasOwnProperty(property)) {
                                $( "#"+property ).css( "border-color", "red");
                                $( "#"+property ).next(".err").css( "color", "red").show().empty().append(obj[property]).fadeIn('slow');
                            }
                        }
                    }
                }, 'json');




                event.preventDefault();
            });
        </script>

        <?php 
        /*
                 *
        Transaction Date *
        
        Sender Name *
        
        Amount Transferred *
        
        Payment to *
        
        Email *
        
        Receipt File (optional)
        Choose File
        Fields marked with * are required.
        */
    }
Exemplo n.º 5
0
 function delete_app()
 {
     $id = addslashes($_GET['app_id']);
     $acc = new App2Acc();
     $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id AND ac_app_id = '{$id}' ", array("AppAccount"));
     if (count($apps) < 1) {
         die("hacking attempt");
     } else {
         $app = $apps[0];
     }
     if ($app->app_active) {
         header("Location:" . _SPPATH . "myapps");
         die;
     }
     AppAccount::checkOwnership($app);
     $appAcc = new AppAccount();
     $appAcc->delete($id);
     $app2Acc = new App2Acc();
     $app2Acc->delete($app->ac_id);
     //delete JSON also
     unlink(_PHOTOPATH . "json/" . $app->app_keywords . ".json");
     header("Location:" . _SPPATH . "myapps");
     die;
 }
Exemplo n.º 6
0
    function appView()
    {
        $id = addslashes($_GET['id']);
        if (in_array("master_admin", Account::getMyRoles())) {
            //            $acc = new AppAccount();
            //            $apps = $acc->getAll();
            //
            $app = new AppAccount();
            $app->getByID($id);
        } else {
            $acc = new App2Acc();
            //AND app_active = 1
            $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id AND ac_app_id = '{$id}' ", array("AppAccount"));
            //            pr($apps);
            if (count($apps) < 1) {
                die("hacking attempt");
            } else {
                $app = $apps[0];
            }
        }
        $paket = new Paket();
        $paket->getByID($app->app_paket_id);
        if (!$app->app_active) {
            header("Location:" . _SPPATH . "PaymentWeb/payfor?app_id=" . $app->app_id);
            die;
        }
        ?>
        <div class="container attop" >
        <div class="col-md-8 col-md-offset-2">
        <small><a href="<?php 
        echo _SPPATH;
        ?>
mydashboard">back to dashboard</a> </small>
        <h1><?php 
        echo $app->app_name;
        ?>
 <small><a href="">edit app</a></small></h1>

        <div class="paket">Paket : <b style="font-size: 18px;"><?php 
        echo $paket->paket_name;
        ?>
</b> &nbsp; <i>[<a href="">Edit Paket</a>]</i> </div>
        <div style="padding: 10px;">
            <?php 
        if (!$app->app_active) {
            ?>

                <a class="btn btn-success btn-lg" href="<?php 
            echo _SPPATH;
            ?>
PaymentWeb/payfor?app_id=<?php 
            echo $app->app_id;
            ?>
">Payment</a>
            <?php 
        } else {
            ?>
                <a class="btn btn-success btn-lg" href="<?php 
            echo _SPPATH;
            ?>
PushHome/setID?app_id=<?php 
            echo $app->app_id;
            ?>
">Admin Panel</a>
            <?php 
        }
        ?>
            </div>
        </div>

        </div>
        <?php 
        //        pr($app);
    }
Exemplo n.º 7
0
    function mydashboard()
    {
        $acc = Account::getAccountObject();
        ?>
        <style>
            #attratas{
                text-align: right;
            }
        </style>
        <div class="container attop"  >
            <div class="col-md-10 col-md-offset-1">
                <h1>Dashboard</h1>
                <div id="attratas">
                   <button onclick="document.location='<?php 
        echo _SPPATH;
        ?>
MyApp/newApp';" class="btn btn-success" style="margin: 0px;">Create New Apps</button>
                    <button onclick="document.location='<?php 
        echo _SPPATH;
        ?>
editAcc';" class="btn btn-info" style=" margin: 0px;">Edit Account</button>
                    <button onclick="document.location='<?php 
        echo _SPPATH;
        ?>
myOrders';" class="btn btn-warning" style=" margin: 0px;">Order History</button>
                </div>

<?php 
        if (in_array("master_admin", Account::getMyRoles())) {
            $acc = new AppAccount();
            $apps = $acc->getAll();
            //
        } else {
            $acc = new App2Acc();
            //AND app_active = 1
            $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id ", array("AppAccount"));
        }
        if (count($apps) > 0) {
            ?>

            <div class="table-responsive" style="margin-top: 20px;">
                <table class="table table-striped table-bordered">
                    <thead>
                    <tr>
                        <th>
                            No.
                        </th>
                        <th>App Name</th>
                        <th>Package</th>
                        <th>Status</th>
                        <th>Expired Date</th>
                        <th>Action</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php 
            foreach ($apps as $num => $ap) {
                $paket = new Paket();
                $paket->getByID($ap->app_paket_id);
                ?>
                        <tr>
                            <td><?php 
                echo $num + 1;
                ?>
</td>
                            <td><?php 
                echo $ap->app_name;
                ?>
</td>
                            <td><?php 
                echo $paket->paket_name;
                ?>
</td>
                            <td><?php 
                echo $ap->app_active;
                ?>
</td>
                            <td><?php 
                if ($ap->app_active == 1) {
                    echo indonesian_date($ap->app_contract_end);
                }
                ?>
</td>
                            <td>
<!--                                <a href='--><?php 
                //=_SPPATH;
                ?>
<!--MyApp/appView?id=--><?php 
                //=$ap->app_id;
                ?>
<!--'  class="btn btn-info">Edit</a>-->
                                <?php 
                if ($ap->app_active == 1) {
                    ?>

                                    <a href='<?php 
                    echo _SPPATH;
                    ?>
PushHome/setID?app_id=<?php 
                    echo $ap->app_id;
                    ?>
'  class="btn btn-success">Admin</a>
                                <?php 
                } else {
                    if ($ap->app_active == 0) {
                        ?>
                                    <a href='<?php 
                        echo _SPPATH;
                        ?>
MyApp/appView?id=<?php 
                        echo $ap->app_id;
                        ?>
'  class="btn btn-danger">Payment</a>


                                <?php 
                    } else {
                        ?>
                                    <button class="btn btn-info">Waiting for Approval</button>
                                <?php 
                    }
                }
                ?>
                            </td>
                        </tr>
                        <?php 
            }
            ?>
                    </tbody>
                </table>
            </div>



    <?php 
        } else {
            ?>
            <h5 class="hype">You do not have any App yet..</h5>
            <button onclick="document.location='<?php 
            echo _SPPATH;
            ?>
MyApp/newApp';" class="btn btn-success"
                    style="width: 100%; margin: 5px;">Create My Own App
            </button>

<?php 
        }
        ?>
            </div>
            <div class="clearfix"></div>

            </div>
        <?php 
    }
Exemplo n.º 8
0
 public function login()
 {
     IMBAuth::checkOAuth();
     $username = addslashes($_POST['username']);
     $password = addslashes($_POST['password']);
     //untuk deviceModel
     $device_id = addslashes($_POST['device_id']);
     $type = addslashes($_POST['type']);
     $acc = new Account();
     $arr = $acc->getWhere("admin_username = '******' OR admin_email ='{$username}'");
     //        pr($arr);
     if (count($arr) > 0) {
         $acc = $arr[0];
         if ($password == $acc->admin_password) {
             $json['status_code'] = 1;
             $json['status_message'] = "Success";
             $json_acc['acc_id'] = $acc->admin_id;
             $json_acc['username'] = $acc->admin_username;
             $json_acc['email'] = $acc->admin_email;
             $json_acc['user_token'] = md5($acc->admin_email . $acc->admin_password);
             $json['account'] = $json_acc;
             //dashboard
             $myid = $acc->admin_id;
             $kom = new KomisiModel();
             $arrKom = $kom->getWhere("komisi_acc_id = '{$myid}'  ORDER BY komisi_app_date ASC");
             $paid = 0;
             $unpaid = 0;
             $total = 0;
             $free = 0;
             $android = 0;
             $androidios = 0;
             $totalpaketbayar = 0;
             $totalpaket = 0;
             foreach ($arrKom as $kom) {
                 if ($kom->komisi_status == 1) {
                     $paid += $kom->komisi_value;
                 } else {
                     $unpaid += $kom->komisi_value;
                 }
                 $total += $kom->komisi_value;
                 if ($kom->komisi_paket_id == 1) {
                     //free
                     $free++;
                 }
                 if ($kom->komisi_paket_id == 2) {
                     //free
                     $android++;
                     $totalpaketbayar++;
                 }
                 if ($kom->komisi_paket_id == 3) {
                     //free
                     $androidios++;
                     $totalpaketbayar++;
                 }
                 $totalpaket++;
             }
             //get applied banner
             $bm = new BannerModel();
             $arrBm = $bm->getWhere("banner_interval_begin <= {$totalpaketbayar} AND banner_interval_end >= {$totalpaketbayar} AND banner_active = 1");
             if (count($arrBm) > 0) {
                 $selBanner = $arrBm[0];
                 $json_banner['banner_img'] = _BPATH . _PHOTOURL . $selBanner->banner_img;
                 $json_banner['banner_link_url'] = $selBanner->banner_link_url;
             }
             //get applied level
             $lv = new LevelModel();
             $arrLvl = $lv->getWhere("level_start<={$totalpaketbayar} AND level_end>={$totalpaketbayar} AND level_active = 1");
             if (count($arrLvl) > 0) {
                 $selLvl = $arrLvl[0];
                 $json_lvl['level_name'] = $selLvl->level_name;
                 $json_lvl['level_img'] = _BPATH . _PHOTOURL . $selLvl->level_img;
             }
             $dashboard['sales_total'] = $totalpaket;
             $dashboard['sales_paid'] = $totalpaketbayar;
             $dashboard['sales_fee'] = $free;
             $dashboard['sales_android'] = $android;
             $dashboard['sales_androidios'] = $androidios;
             $dashboard['money_total'] = $total;
             $dashboard['money_paid'] = $paid;
             $dashboard['money_unpaid'] = $unpaid;
             $dashboard['banner'] = $json_banner;
             $dashboard['level'] = $json_lvl;
             $json['dashboard'] = $dashboard;
             //myapps
             $app2acc = new App2Acc();
             //AND app_active = 1
             $apps = $app2acc->getWhereFromMultipleTable("ac_admin_id = '" . $acc->admin_id . "' AND ac_app_id = app_id ", array("AppAccount"));
             if (count($apps) > 0) {
                 foreach ($apps as $ap) {
                     $rr = array();
                     $rr['app_id'] = $ap->app_id;
                     $rr['app_icon'] = $ap->app_icon;
                     $rr['app_name'] = $ap->app_name;
                     $rr['app_active'] = $ap->app_active;
                     $rr['app_shortdes'] = $ap->app_shortdes;
                     $rr['app_token'] = $ap->app_token;
                     $rr['app_contract_end'] = $ap->app_contract_end;
                     $rr['app_google_play_link'] = $ap->app_google_play_link;
                     $rr['app_google_version'] = $ap->app_google_version;
                     $rr['app_ios_link'] = $ap->app_ios_link;
                     $rr['app_ios_version'] = $ap->app_ios_version;
                     $paket = new Paket();
                     $paket->getByID($ap->app_paket_id);
                     $rr['paket']['paket_id'] = $paket->paket_id;
                     $rr['paket']['paket_name'] = $paket->paket_name;
                     $json['apps'][] = $rr;
                 }
             } else {
                 $json['apps'] = array();
             }
             //update the device id on deviceModelCaps
             $dn = new DeviceModelCapsule();
             $dnquery = new DeviceModelCapsule();
             // langkah 1 , device ID ada device type ada
             $arrs = $dnquery->getWhere("device_id = '{$device_id}' AND device_type = '{$type}'");
             $dn = $arrs[0];
             if ($dn->did == "") {
                 $dn = new DeviceModelCapsule();
                 $dn->device_id = $device_id;
                 $dn->device_type = $type;
                 $dn->acc_id = $acc->admin_id;
                 $dn->firstlogin = leap_mysqldate();
             } else {
                 //kalau device id ada, acc di update
                 $dn->load = 1;
                 $dn->acc_id = $acc->admin_id;
             }
             $dn->dev_lng = addslashes($_POST['lng']);
             $dn->dev_lat = addslashes($_POST['lat']);
             $dn->logindate = leap_mysqldate();
             if ($dn->save()) {
                 $json['save_device_status'] = 1;
             }
             $json['powered_by_link'] = Efiwebsetting::getData("Powered_By_Link_Caps");
             echo json_encode($json);
             die;
         } else {
             $json['status_code'] = 0;
             $json['status_message'] = "Password Mismatched";
             echo json_encode($json);
             die;
         }
     } else {
         $json['status_code'] = 0;
         $json['status_message'] = "User Not Found";
         echo json_encode($json);
         die;
     }
 }
Exemplo n.º 9
0
    static function getMyApps()
    {
        $acc = Account::getAccountObject();
        ?>
        <style>
            @media (max-width: 768px) {

                .monly {
                    display: initial;
                }

                .donly {
                    display: none;
                }

                .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9 {
                    padding-left: 0px;
                    padding-right: 0px;

                }
                .container {
                    padding-right: 0px;
                    padding-left: 0px;
                }
                .attop{
                    /*padding-top: 50px;*/
                }
                #session{
                    margin-left: 15px; margin-right: 15px;
                }
            }

            @media (min-width: 768px) {
                .monly {
                    display: none;
                }

                .donly {
                    display: initial;
                }
                #attratas{
                    margin-top: 30px;
                }
                #agentbanner{
                    padding-right: 0px;
                }
                .stats{
                    /*min-height: 250px;*/
                }
                .stats_text{
                    /*padding-top: 30px;*/
                }
                .stats_number_big{
                    /*font-size: 40px;*/
                }
                .stats_money{
                    font-weight: bold;
                    /*font-size: 30px;*/
                }
                .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-xs-1, .col-xs-10, .col-xs-11, .col-xs-12, .col-xs-2, .col-xs-3, .col-xs-4, .col-xs-5, .col-xs-6, .col-xs-7, .col-xs-8, .col-xs-9 {
                    padding-left: 0px;
                    padding-right: 0px;

                }
            }
        </style>
        <div class="container attop"  >
        <div class="col-md-12">
        <div class="appear_logo_pages">
            <a href="<?php 
        echo _SPPATH;
        ?>
">
                <img src="<?php 
        echo _SPPATH;
        ?>
images/appear-apps.png" >
            </a>
        </div>

        <div id="attratas">
            <button id="list" onclick="$('#list').hide();$('#icons').show();$('#app_icons').hide();$('#app_lists').show();" class="btn btn-success btn-abu" style="margin: 0px;display: none;"><i class="glyphicon glyphicon-th-list"></i></button>
            <button id="icons" onclick="$('#list').show();$('#icons').hide();$('#app_icons').show();$('#app_lists').hide();" class="btn btn-success btn-abu" style="margin: 0px;"><i class="glyphicon glyphicon-th"></i></button>
            <button onclick="document.location='<?php 
        echo _SPPATH;
        ?>
mydashboard';" class="btn btn-success btn-abu" style="margin: 0px;">Dashboard</button>
            <button onclick="document.location='<?php 
        echo _SPPATH;
        ?>
apps/makenew';" class="btn btn-success btn-abu" style="margin: 0px;">Create New Apps</button>
        </div>
        <?php 
        if (ZAppFeature::checkRemainingSession()) {
            $link = _SPPATH . "apps/make";
            if ($_SESSION['ZAppFeature']['app_id'] > 0) {
                $link = _SPPATH . "apps/make?id=" . $_SESSION['ZAppFeature']['app_id'];
            }
            ?>

    <div id="session" class="alert alert-warning" role="alert" >
        You have unsaved edit Sessions. Click <a href="<?php 
            echo $link;
            ?>
">here</a> to continue work on your app
        </div>



        <?php 
        }
        ?>
        <?php 
        if (in_array("master_admin", Account::getMyRoles())) {
            $acc = new AppAccount();
            $apps = $acc->getAll();
            //http://localhost:8888/appear/PushHome/home?st=Balance
        } else {
            $acc = new App2Acc();
            //AND app_active = 1
            $apps = $acc->getWhereFromMultipleTable("ac_admin_id = '" . Account::getMyID() . "' AND ac_app_id = app_id ", array("AppAccount"));
        }
        if (count($apps) > 0) {
            ?>
<div id="app_icons" style="display: none;">
            <?php 
            foreach ($apps as $num => $ap) {
                ?>
                <div class="col-md-3 col-sm-12 col-xs-12 myapp">
                    <div id="detail_<?php 
                echo $num;
                ?>
" class="app_detail" style="display: none;" onclick="openDetails('<?php 
                echo $num;
                ?>
');">
                        <div style="padding: 20px;">
                            <h3><?php 
                echo $ap->app_name;
                ?>
</h3>
                            <?php 
                $paket = new Paket();
                if ($ap->app_paket_id > 0) {
                    $paket->getByID($ap->app_paket_id);
                    echo '<div class="app_paket">' . $paket->paket_name . '</div>';
                }
                ?>
                            <?php 
                $status = $ap->app_active;
                echo '<div class="app_status">';
                if ($status == 0) {
                    echo "Not active";
                }
                if ($status == 1) {
                    if ($ap->app_type == 1) {
                        echo "pending approval";
                    } else {
                        echo "App is being created";
                    }
                }
                if ($status == 2) {
                    echo "Up and running";
                }
                echo "</div>";
                ?>
                            <?php 
                if ($ap->app_active > 0 && $ap->app_type == 0) {
                    echo '<div class="app_contract">contract ends : ' . date("d-m-Y", strtotime($ap->app_contract_end));
                    if ($ap->app_active == 2) {
                        if ($ap->app_paket_id > 1) {
                            ?>
                                        <br>
                                        <a  href="<?php 
                            echo _SPPATH;
                            ?>
PaymentWeb/extend?app_id=<?php 
                            echo $ap->app_id;
                            ?>
">extend</a>
                                    <?php 
                        } elseif ($ap->app_paket_id == 1) {
                            //check if tinggal sebulan
                            $diff = dateDifference(date("Y-m-d", strtotime($ap->app_contract_end)), date("Y-m-d"), "%a");
                            //                                    echo "<br>".$diff;
                            if ($diff <= 30) {
                                ?>
<br>
                                            <a  href="<?php 
                                echo _SPPATH;
                                ?>
PaymentWeb/extend_paket_1?app_id=<?php 
                                echo $ap->app_id;
                                ?>
">extend</a>
                                        <?php 
                            }
                        }
                    }
                    echo '</div>';
                }
                ?>

                            <?php 
                if ($ap->app_active == 2) {
                    if ($ap->app_paket_id == 1 || $ap->app_paket_id == 2) {
                        ?>
                                    <a href='<?php 
                        echo _SPPATH;
                        ?>
PaymentWeb/upgrade?app_id=<?php 
                        echo $ap->app_id;
                        ?>
'  class="btn btn-success">Upgrade</a>

                                <?php 
                    }
                    ?>

                                <a href='<?php 
                    echo _SPPATH;
                    ?>
pushnotif?app_id=<?php 
                    echo $ap->app_id;
                    ?>
'  class="btn btn-success btn-abu">Push Notifications</a>
                                <br>
                            <?php 
                } else {
                    if ($ap->app_active == 0) {
                        ?>
                                <!--                                    <a href='--><?php 
                        //=_SPPATH;
                        ?>
<!--MyApp/appView?id=--><?php 
                        //=$ap->app_id;
                        ?>
<!--'  class="btn btn-danger">Payment</a>-->
                                <a href='<?php 
                        echo _SPPATH;
                        ?>
PaymentWeb/pay?app_id=<?php 
                        echo $ap->app_id;
                        ?>
'  class="btn btn-danger">Payment</a>
                                <a href='<?php 
                        echo _SPPATH;
                        ?>
delete_app?app_id=<?php 
                        echo $ap->app_id;
                        ?>
' onclick="return confirm('This will delete this App?')"  class="btn btn-success btn-abu">Delete</a>

                            <?php 
                    }
                }
                ?>

                            <a href='<?php 
                echo _SPPATH;
                ?>
apps/edit?id=<?php 
                echo $ap->app_id;
                ?>
'  class="btn btn-success btn-abu">Edit</a>
                            <a href='<?php 
                echo _SPPATH;
                ?>
preview?id=<?php 
                echo $ap->app_id;
                ?>
'  class="btn btn-success btn-abu">Preview</a>
                            <a href='<?php 
                echo _SPPATH;
                ?>
uploads/json/<?php 
                echo $ap->app_keywords;
                ?>
.json' target="_blank"  class="btn btn-success btn-abu">JSON</a>

                        </div>
                    </div>
                    <div id="app_<?php 
                echo $num;
                ?>
" class="app_icon" onclick="openDetails('<?php 
                echo $num;
                ?>
');">
                        <img width="100%" src="<?php 
                echo $ap->app_icon;
                ?>
">
                        <div style="display:none;position: absolute; background-color: rgba(0,0,0,0.5); border-radius: 0px; text-align: center; font-size: 18px; padding: 10px; margin-top: -53px; margin-left:10px; z-index:1; color: #ffffff;">
                            <?php 
                echo $ap->app_name;
                ?>
                        </div>
                    </div>
                </div>
            <?php 
            }
            ?>
            <script>
                function openDetails(n){
                    $('#detail_'+n).fadeToggle( "slow", "linear" );
                    console.log($('#app_'+n).width());
                    $('#detail_'+n).css("width",$('#app_'+n).width()+'px');
                    $('#detail_'+n).css("height",$('#app_'+n).height()+'px');
                }
            </script>
            <style>
                .app_detail{
                    position: absolute;
                    background-color: rgba(0,0,0,0.8);
                    width: 100px;
                    height: 200px;
                    color: #ffffff;
                    text-align: center;
                    z-index: 10;
                }
                .myapp{
                    cursor: pointer;
                }
                .app_contract{
                    font-style: italic;
                    font-size: 12px;
                }
                .myapp a{
                    color: #B2DFDB;
                    text-decoration: underline;
                }
                .myapp a.btn{
                    text-decoration: none;
                    margin: 5px;
                    color: #ffffff;
                }
                .entry{
                    padding: 5px;
                    background-color: #F7F7F7;
                    margin: 5px;
                }
                .entry a.btn{
                    text-decoration: none;
                    margin: 2px;
                    color: #ffffff;
                }
            </style>
            </div>
            <div class="clearfix"></div>
            <div id="app_lists" >
            <?php 
            foreach ($apps as $num => $ap) {
                //                        $paket = new Paket();
                //                        $paket->getByID($ap->app_paket_id);
                ?>

                <div class=" col-md-6 col-sm-12 col-xs-12">
                <div class="entry">
                <div class="col-md-6 col-sm-6 col-xs-6">
                    <img width="100%" src="<?php 
                echo $ap->app_icon;
                ?>
">

                </div>
                <div class="col-md-6 col-sm-6 col-xs-6" style="text-align: center;">
                    <h3><?php 
                echo $ap->app_name;
                ?>
</h3>
                    <?php 
                $paket = new Paket();
                if ($ap->app_paket_id > 0) {
                    $paket->getByID($ap->app_paket_id);
                    echo '<div class="app_paket">' . $paket->paket_name . '</div>';
                }
                ?>
                    <?php 
                $status = $ap->app_active;
                echo '<div class="app_status">';
                if ($status == 0) {
                    echo "Not active";
                }
                if ($status == 1) {
                    if ($ap->app_type == 1) {
                        echo "pending approval";
                    } else {
                        echo "App is being created";
                    }
                }
                if ($status == 2) {
                    echo "Up and running";
                }
                echo "</div>";
                ?>
                    <?php 
                if ($ap->app_active > 0 && $ap->app_type == 0) {
                    echo '<div class="app_contract">contract ends : ' . date("d-m-Y", strtotime($ap->app_contract_end));
                    if ($ap->app_active == 2) {
                        if ($ap->app_paket_id > 1) {
                            ?>
                                <br>
                                <a  href="<?php 
                            echo _SPPATH;
                            ?>
PaymentWeb/extend?app_id=<?php 
                            echo $ap->app_id;
                            ?>
">extend</a>
                            <?php 
                        } elseif ($ap->app_paket_id == 1) {
                            //check if tinggal sebulan
                            $diff = dateDifference(date("Y-m-d", strtotime($ap->app_contract_end)), date("Y-m-d"), "%a");
                            //                                    echo "<br>".$diff;
                            if ($diff <= 30) {
                                ?>
                                    <br>
                                    <a  href="<?php 
                                echo _SPPATH;
                                ?>
PaymentWeb/extend_paket_1?app_id=<?php 
                                echo $ap->app_id;
                                ?>
">extend</a>
                                <?php 
                            }
                        }
                    }
                    echo '</div>';
                }
                ?>

                    <?php 
                if ($ap->app_active == 2) {
                    if ($ap->app_paket_id == 1 || $ap->app_paket_id == 2) {
                        ?>
                            <a href='<?php 
                        echo _SPPATH;
                        ?>
PaymentWeb/upgrade?app_id=<?php 
                        echo $ap->app_id;
                        ?>
'  class="btn btn-success">Upgrade</a>

                        <?php 
                    }
                    ?>

                        <a href='<?php 
                    echo _SPPATH;
                    ?>
pushnotif?app_id=<?php 
                    echo $ap->app_id;
                    ?>
'  class="btn btn-success btn-abu">Push Notifications</a>
                        <br>
                    <?php 
                } else {
                    if ($ap->app_active == 0) {
                        ?>
                        <!--                                    <a href='--><?php 
                        //=_SPPATH;
                        ?>
<!--MyApp/appView?id=--><?php 
                        //=$ap->app_id;
                        ?>
<!--'  class="btn btn-danger">Payment</a>-->
                        <a href='<?php 
                        echo _SPPATH;
                        ?>
PaymentWeb/pay?app_id=<?php 
                        echo $ap->app_id;
                        ?>
'  class="btn btn-danger">Payment</a>
                        <a href='<?php 
                        echo _SPPATH;
                        ?>
delete_app?app_id=<?php 
                        echo $ap->app_id;
                        ?>
' onclick="return confirm('This will delete this App?')"  class="btn btn-success btn-abu">Delete</a>

                    <?php 
                    }
                }
                ?>

                    <a href='<?php 
                echo _SPPATH;
                ?>
apps/edit?id=<?php 
                echo $ap->app_id;
                ?>
'  class="btn btn-success btn-abu">Edit</a>
                    <a href='<?php 
                echo _SPPATH;
                ?>
preview?id=<?php 
                echo $ap->app_id;
                ?>
'  class="btn btn-success btn-abu">Preview</a>
                    <a href='<?php 
                echo _SPPATH;
                ?>
uploads/json/<?php 
                echo $ap->app_keywords;
                ?>
.json' target="_blank"  class="btn btn-success btn-abu">JSON</a>

                </div>

                    <div class="clearfix"></div>
                </div>
                </div>

            <?php 
            }
            ?>
            </div>
            <style>
                .table{
                    background-color: white;
                }
            </style>
            <div id="app_table" class="table-responsive" style="margin-top: 20px; display: none;">
                <table class="table table-striped table-bordered">
                    <thead>
                    <tr>
                        <th>
                            No.
                        </th>
                        <th>App</th>
                        <th>Action</th>
                        <th>Paket</th>
                        <th>Expired Date</th>
                        <th>Status</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php 
            foreach ($apps as $num => $ap) {
                //                        $paket = new Paket();
                //                        $paket->getByID($ap->app_paket_id);
                ?>
                        <tr>
                            <td><?php 
                echo $num + 1;
                ?>
</td>
                            <td style="text-align: center;">
                                <div class="foto100">
                                    <img width="100px" src="<?php 
                echo $ap->app_icon;
                ?>
">
                                </div>

                                <?php 
                echo $ap->app_name;
                ?>
                            </td>
                            <td>
                                <!--                                <a href='--><?php 
                //=_SPPATH;
                ?>
<!--MyApp/appView?id=--><?php 
                //=$ap->app_id;
                ?>
<!--'  class="btn btn-info">Edit</a>-->
                                <?php 
                if ($ap->app_active == 2) {
                    if ($ap->app_paket_id == 1 || $ap->app_paket_id == 2) {
                        ?>
                                        <a href='<?php 
                        echo _SPPATH;
                        ?>
PaymentWeb/upgrade?app_id=<?php 
                        echo $ap->app_id;
                        ?>
'  class="btn btn-success">Upgrade</a>

                                    <?php 
                    }
                    ?>

                                    <a href='<?php 
                    echo _SPPATH;
                    ?>
pushnotif?app_id=<?php 
                    echo $ap->app_id;
                    ?>
'  class="btn btn-success">Push Notifications</a>
                                    <br>
                                <?php 
                } else {
                    if ($ap->app_active == 0) {
                        ?>
                                    <!--                                    <a href='--><?php 
                        //=_SPPATH;
                        ?>
<!--MyApp/appView?id=--><?php 
                        //=$ap->app_id;
                        ?>
<!--'  class="btn btn-danger">Payment</a>-->
                                    <a href='<?php 
                        echo _SPPATH;
                        ?>
PaymentWeb/pay?app_id=<?php 
                        echo $ap->app_id;
                        ?>
'  class="btn btn-danger">Payment</a>
                                    <a href='<?php 
                        echo _SPPATH;
                        ?>
delete_app?app_id=<?php 
                        echo $ap->app_id;
                        ?>
' onclick="return confirm('This will delete this App?')"  class="btn btn-danger">Delete</a>

                                <?php 
                    }
                }
                ?>

                                <a href='<?php 
                echo _SPPATH;
                ?>
apps/edit?id=<?php 
                echo $ap->app_id;
                ?>
'  class="btn btn-danger">Edit</a>
                                <a href='<?php 
                echo _SPPATH;
                ?>
preview?id=<?php 
                echo $ap->app_id;
                ?>
'  class="btn btn-danger">Preview</a>
                                <a href='<?php 
                echo _SPPATH;
                ?>
uploads/json/<?php 
                echo $ap->app_keywords;
                ?>
.json' target="_blank"  class="btn btn-danger">JSON</a>
                            </td>
                            <td>
                                <?php 
                $paket = new Paket();
                if ($ap->app_paket_id > 0) {
                    $paket->getByID($ap->app_paket_id);
                    echo $paket->paket_name;
                }
                ?>
                            </td>
                            <td>
                                <?php 
                if ($ap->app_active > 0) {
                    echo date("d-m-Y", strtotime($ap->app_contract_end));
                    if ($ap->app_active == 2) {
                        if ($ap->app_paket_id > 1) {
                            ?>
                                            <br>
                                            <a class="btn btn-default" href="<?php 
                            echo _SPPATH;
                            ?>
PaymentWeb/extend?app_id=<?php 
                            echo $ap->app_id;
                            ?>
">extend</a>
                                        <?php 
                        } elseif ($ap->app_paket_id == 1) {
                            //check if tinggal sebulan
                            $diff = dateDifference(date("Y-m-d", strtotime($ap->app_contract_end)), date("Y-m-d"), "%a");
                            //                                    echo "<br>".$diff;
                            if ($diff <= 30) {
                                ?>
                                                <br>
                                                <a class="btn btn-default" href="<?php 
                                echo _SPPATH;
                                ?>
PaymentWeb/extend_paket_1?app_id=<?php 
                                echo $ap->app_id;
                                ?>
">extend</a>
                                            <?php 
                            }
                        }
                    }
                }
                ?>
                            </td>

                            <td><?php 
                $status = $ap->app_active;
                if ($status == 0) {
                    echo "Your App is not active";
                }
                if ($status == 1) {
                    echo "Your App is being created.<br>For Android App, it will take up to 2 working days.<br>For iOS, it will take up to 3 weeks.";
                }
                if ($status == 2) {
                    echo "Your App is up and running";
                }
                ?>
</td>

                        </tr>
                    <?php 
            }
            ?>
                    </tbody>
                </table>
            </div>
            </div>
            <div class="clearfix" style="margin-bottom: 100px;"></div>

            </div>
        <?php 
        } else {
            header("Location:" . _SPPATH . "apps/make");
            exit;
        }
    }