Ejemplo n.º 1
0
     $resellerId = $row['resellerid'];
 }
 if (isset($cname)) {
     // Nothing submitted yet, display the delete form
     if (!$ui->st('action', 'post')) {
         $template_file = 'admin_user_dl.tpl';
         // User submitted remove the entry
     } else {
         if ($ui->st('action', 'post') == 'dl') {
             // Deactivate all old jobs belonging to this user
             $query = $sql->prepare("UPDATE `jobs` SET `status`='2' WHERE `type`='us' AND (`status` IS NULL OR `status`='1') AND `userID`=? and `resellerID`=?");
             $query->execute(array($id, $resellerId));
             // Add the removal job
             $query = $sql->prepare("INSERT INTO `jobs` (`api`,`type`,`invoicedByID`,`affectedID`,`userID`,`name`,`status`,`date`,`action`,`resellerid`) VALUES ('U','us',?,?,?,?,NULL,NOW(),'dl',?)");
             $query->execute(array($admin_id, $id, $id, $cname, $resellerId));
             updateJobs($id, $resellerLockupID);
             // Check if a row was affected meaning an entry could be deleted. If yes add log entry and display success message
             if ($query->rowCount() > 0) {
                 $query = $sql->prepare("UPDATE `userdata` SET `jobPending`='Y' WHERE `id`=? AND `resellerid`=? LIMIT 1");
                 $query->execute(array($id, $resellerId));
                 $template_file = $spracheResponse->table_del;
                 $loguseraction = '%del% %user% ' . $cname;
                 $insertlog->execute();
                 // Nothing was deleted, display an error
             } else {
                 $template_file = $spracheResponse->error_table;
             }
         }
     }
     // GET Request did not add up. Display 404 error.
 } else {
Ejemplo n.º 2
0
     $localID = isset($data['localid']) ? $data['localid'] : '';
     if (dataExist('identify_by', $data)) {
         $query = $sql->prepare("SELECT `id`,`cname` FROM `userdata` WHERE `" . $from[$data['identify_by']] . "`=? AND `resellerid`=?");
         $query->execute(array($data[$data['identify_by']], $resellerID));
         while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
             $localID = $row['id'];
             $name = $row['cname'];
         }
         if (isset($localID) and isset($name)) {
             $query = $sql->prepare("UPDATE `userdata` SET `jobPending`='Y' WHERE `id`=? and `resellerid`=?");
             $query->execute(array($localID, $resellerID));
             $query = $sql->prepare("UPDATE `jobs` SET `status`='2' WHERE (`status` IS NULL OR `status`='1') AND `userID`=? and `resellerID`=?");
             $query->execute(array($localID, $resellerID));
             $query = $sql->prepare("INSERT INTO `jobs` (`api`,`type`,`invoicedByID`,`affectedID`,`userID`,`name`,`status`,`date`,`action`,`resellerid`) VALUES ('A','us',?,?,?,?,NULL,NOW(),'dl',?)");
             $query->execute(array($resellerID, $localID, $localID, $name, $resellerID));
             updateJobs($localID, $resellerID);
         } else {
             $success['false'][] = 'No user can be found to delete';
         }
     } else {
         $success['false'][] = 'No data for this method';
     }
 } else {
     if (array_value_exists('action', 'ls', $data) and isset($data['identify_by']) and isset($data[$data['identify_by']]) and !in_array($data[$data['identify_by']], $bad)) {
         $userArray = array('userdetails' => array(), 'gserver' => array(), 'voice' => array(), 'mysql' => array(), 'tsdns' => array(), 'webspace' => array());
         $from = array('localid' => 'id', 'username' => 'cname', 'external_id' => 'externalID', 'email' => 'mail', 'mysql' => array());
         $email = isset($data['email']) ? $data['email'] : '';
         $identifyBy = $data['identify_by'];
         $username = isset($data['username']) ? $data['username'] : '';
         $externalID = (isset($data['external_id']) and isExternalID($data['external_id']) != '') ? $data['external_id'] : '';
         $localID = isset($data['localid']) ? $data['localid'] : '';
Ejemplo n.º 3
0
        $insert->execute(array($row['invoicedByID'], $row2['id'], $row2['rootID'], $row['affectedID'], $row2['serverip'] . ':' . $row2['port'], $row['action'], $row['extraData'], $row2['resellerid']));
    }
    $query2 = $sql->prepare("SELECT `id`,`masterserver`,`ip`,`port`,`resellerid` FROM `voice_server` WHERE `userid`=?");
    $query2->execute(array($row['affectedID']));
    $insert = $sql->prepare("INSERT INTO `jobs` (`api`,`type`,`invoicedByID`,`affectedID`,`hostID`,`userID`,`name`,`status`,`date`,`action`,`extraData`,`resellerid`) VALUES ('S','vo',?,?,?,?,?,NULL,NOW(),?,?,?)");
    while ($row2 = $query2->fetch(PDO::FETCH_ASSOC)) {
        $insert->execute(array($row['invoicedByID'], $row2['id'], $row2['masterserver'], $row['affectedID'], $row2['ip'] . ':' . $row2['port'], $row['action'], $row['extraData'], $row2['resellerid']));
    }
    $query2 = $sql->prepare("SELECT `dnsID`,`dns`,`ip`,`port`,`tsdnsID`,`resellerID` FROM `voice_dns` WHERE `userID`=?");
    $query2->execute(array($row['affectedID']));
    $insert = $sql->prepare("INSERT INTO `jobs` (`api`,`type`,`invoicedByID`,`affectedID`,`hostID`,`userID`,`name`,`status`,`date`,`action`,`extraData`,`resellerid`) VALUES ('S','ds',?,?,?,?,?,NULL,NOW(),?,?,?)");
    while ($row2 = $query2->fetch(PDO::FETCH_ASSOC)) {
        $insert->execute(array($row['invoicedByID'], $row2['dnsID'], $row2['tsdnsID'], $row['affectedID'], $row2['ip'] . ':' . $row2['port'] . ' ' . $row2['dns'], $row['action'], $row['extraData'], $row2['resellerID']));
    }
    $query2 = $sql->prepare("SELECT `id`,`sid`,`dbname`,`resellerid` FROM `mysql_external_dbs` WHERE `uid`=?");
    $query2->execute(array($row['affectedID']));
    $insert = $sql->prepare("INSERT INTO `jobs` (`api`,`type`,`invoicedByID`,`affectedID`,`hostID`,`userID`,`name`,`status`,`date`,`action`,`extraData`,`resellerid`) VALUES ('S','my',?,?,?,?,?,NULL,NOW(),?,?,?)");
    while ($row2 = $query2->fetch(PDO::FETCH_ASSOC)) {
        $insert->execute(array($row['invoicedByID'], $row2['id'], $row2['sid'], $row['affectedID'], $row2['dbname'], $row['action'], $row['extraData'], $row2['resellerid']));
    }
    $query2 = $sql->prepare("SELECT `webVhostID`,`webMasterID`,`resellerID` FROM `webVhost` WHERE `userID`=?");
    $query2->execute(array($row['affectedID']));
    $insert = $sql->prepare("INSERT INTO `jobs` (`api`,`type`,`invoicedByID`,`affectedID`,`hostID`,`userID`,`name`,`status`,`date`,`action`,`extraData`,`resellerid`) VALUES ('S','wv',?,?,?,?,?,NULL,NOW(),?,?,?)");
    while ($row2 = $query2->fetch(PDO::FETCH_ASSOC)) {
        $insert->execute(array($row['invoicedByID'], $row2['webVhostID'], $row2['webMasterID'], $row['affectedID'], 'web-' . $row2['webVhostID'], $row['action'], $row['extraData'], $row2['resellerID']));
    }
    $query2 = $sql->prepare("UPDATE `jobs` SET `status`='4' WHERE `jobID`=? LIMIT 1");
    $query2->execute(array($row['jobID']));
    updateJobs($row['affectedID'], $row['resellerID'], 'Y');
    $theOutput->printGraph($command);
}