| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace MGModule\DNSManager2\mgLibs\custom\helpers;
- class TransferHelper
- {
-
-
- public static function verifyAction( $data = null )
- {
- if($data['dnsaction'] == 'transfer' ||
- (strpos($_SERVER['PHP_SELF'], 'clientsmove') &&
- $data['action'] == 'transfer' ))
- {
- return true;
- }
- }
-
-
-
- public static function transferZone( $data )
- {
- if(self::verifyAction( $data ))
- {
- try {
- \MGModule\DNSManager2\addon::I(true);
- $id = (int)$data['id'];
- $newuserid = (int)$data['newuserid'];
- $repositoryName = ($data['type'] == 'hosting') ? '\MGModule\DNSManager2\models\whmcs\service\service' :
- '\MGModule\DNSManager2\models\whmcs\domains\domain';
- $transferedObj = new $repositoryName($id);
- $zoneitems = \MGModule\DNSManager2\models\custom\zone\Repository::factory()
- ->byClientID($transferedObj->clientID())
- ->byRelID($id)
- ->get();
- foreach ($zoneitems as $zoneitem) {
- $Zone = new \MGModule\DNSManager2\models\custom\zone\Zone($zoneitem->id);
- $Zone->save(array('clientid' => $newuserid));
- }
- } catch (Exception $ex) {
- }
- }
- }
-
- }
|