Example #1
0
function add_admin($pass)
{
    global $gbl, $sgbl, $login, $ghtml;
    $client = new Client(null, null, 'admin');
    $login = $client;
    $client->initThisDef();
    $client->priv->pserver_num = 'Unlimited';
    $client->priv->maindomain_num = 'Unlimited';
    $client->priv->vps_num = 'Unlimited';
    $client->priv->client_num = 'Unlimited';
    $client->ddate = time();
    $ddb = new Sqlite(null, "client");
    if (!$ddb->existInTable("nname", 'admin')) {
        if ($sgbl->dbg > 0) {
            $pass = '******';
            $res['contacemail'] = '*****@*****.**';
        }
        $res['password'] = crypt($pass);
        $res['cttype'] = 'admin';
        $res['cpstatus'] = 'on';
        if (if_demo()) {
            $res['email'] = "*****@*****.**";
        }
        $client->create($res);
        $client->driverApp = new client__sync(null, null, 'admin');
        $client->was();
        lxfile_mkdir("__path_client_root/{$client->nname}");
        lxfile_generic_chown("__path_client_root/{$client->nname}", "lxlabs");
    }
    $notif = new Notification(null, null, $client->getClName());
    $notif->initThisDef();
    $notif->dbaction = 'add';
    $notif->text_newaccountmessage = lfile_get_contents("__path_program_root/file/welcome.txt");
    $notif->parent_clname = $client->getClName();
    $notif->write();
    $display = new sp_SpecialPlay(null, null, $client->getClName());
    $display->initThisDef();
    $display->parent_clname = $client->getClName();
    $display->dbaction = 'add';
    $display->write();
}
Example #2
0
 static function process_paypal($list)
 {
     initProgram('admin');
     $sq = new Sqlite(null, 'paymentdetail');
     $r = paymentdetail__paypal::createPaymentDetail($list);
     if (self::checkIftransactionExists($r['transactionid'])) {
         log_log("paypal_billing", "Transactionid {$r['transactionid']} already exists\n");
         return;
     }
     $i = 0;
     while (true) {
         $r['nname'] = implode("___", array($r['client'], $r['month'], $i));
         if (!$sq->getRowsWhere("nname = '{$r['nname']}'")) {
             break;
         }
         $i++;
     }
     $r['parent_clname'] = createParentName('client', $r['client']);
     $cl = new Client(null, null, $r['client']);
     $cl->get();
     if (!$cl->isOn('status')) {
         $cl->updateEnable(null);
         $cl->was();
     }
     $payp = new paymentDetail(null, null, $r['nname']);
     $r['complete_detail'] = $list;
     $r['paymentgw'] = 'paypal';
     $payp->create($r);
     $payp->write();
     log_log("paypal_billing", "saved the payment detail {$p->nname}");
 }