Jump to content

WHMS Custom Module Edit Product Page CSS Missing? Page Messed Up


jmiller4180

Recommended Posts

Hello,

I am working on a custom module. I obviously did something wrong. The admin product edit page looks really messed up and appears to be missing styling. The last thing I did before this started happening was add mysql queries and inserts, but I can't imagine those things being the cause of missing styles all of a sudden. I would think errors would show as well. Here is a screenshot of what the admin page looks like.

 

configproducts.php.png

 

My Code:

<?php
error_reporting(E_ALL);
function template_ConfigOptions() {

# Should return an array of the module options for each product - maximum of 24

   $configarray = array(
 "Mobile Phone" => array( "Type" => "text", "Size" => "10", ),
 "Message Quota" => array( "Type" => "text", "Size" => "5", "Description" => "How many messages are allowed per month." ),
 );

return $configarray;

}

function template_CreateAccount($params) {

   # ** The variables listed below are passed into all module functions **

   $serviceid = $params["serviceid"]; # Unique ID of the product/service in the WHMCS Database
   $pid = $params["pid"]; # Product/Service ID
   $producttype = $params["producttype"]; # Product Type: hostingaccount, reselleraccount, server or other
   $domain = $params["domain"];
$username = $params["username"];
$password = $params["password"];
   $clientsdetails = $params["clientsdetails"]; # Array of clients details - firstname, lastname, email, country, etc...
   $customfields = $params["customfields"]; # Array of custom field values for the product
   $configoptions = $params["configoptions"]; # Array of configurable option values for the product

   # Product module option settings from ConfigOptions array above
   $configoption1 = $params["configoption1"];
   $configoption2 = $params["configoption2"];
   $configoption3 = $params["configoption3"];
   $configoption4 = $params["configoption4"];

   # Additional variables if the product/service is linked to a server
   $server = $params["server"]; # True if linked to a server
   $serverid = $params["serverid"];
   $serverip = $params["serverip"];
   $serverusername = $params["serverusername"];
   $serverpassword = $params["serverpassword"];
   $serveraccesshash = $params["serveraccesshash"];
   $serversecure = $params["serversecure"]; # If set, SSL Mode is enabled in the server config

# Code to perform action goes here...

if ($successful) {
$table = "tblhosting";
$fields = "server,username,password";
$where = array("userid"=>$userid);
$result = select_query($table,$fields,$where) or die('Error, insert query failed');
while ($data = mysql_fetch_array($result)) {
   $serverusername = $data['username'];
$serverpassword = $data['password'];
   $serverid = $data['server'];
   # Your code goes here...
}
$mobilephone = $params[‘configoptions’][‘Mobile Phone Number’];
$table = "tblservers";
$fields = "name";
$where = array("id"=>$serverid);
$result = select_query($table,$fields,$where) or die('Error, insert query failed');
while ($data2 = mysql_fetch_array($result)) {
   $servername = $data2['name'];
   $serverid = $data2['server'];

}
$table = "tblsmscentova";
$values = array("userid"=>"$userid","servername"=>"$servername","userlogin"=>"$serverusername","userpassword"=>"$serverpassword","mobilenumber"=>"$mobilephone");
$newid = insert_query($table,$values) or die('Error, insert query failed');



} else {
	$result = "Yikes! Something went horribly wrong and world destruction is about to happen!";
}
return $result;

}

function template_TerminateAccount($params) {

# Code to perform action goes here...

   if ($successful) {
	$result = "success";
} else {
	$result = "Error Message Goes Here...";
}
return $result;

}

function template_SuspendAccount($params) {

# Code to perform action goes here...

   if ($successful) {
	$result = "success";
} else {
	$result = "Error Message Goes Here...";
}
return $result;

}

function template_UnsuspendAccount($params) {

# Code to perform action goes here...

   if ($successful) {
	$result = "success";
} else {
	$result = "Error Message Goes Here...";
}
return $result;

}

function template_ChangePassword($params) {

# Code to perform action goes here...

   if ($successful) {
	$result = "success";
} else {
	$result = "Error Message Goes Here...";
}
return $result;

}

function template_ChangePackage($params) {

# Code to perform action goes here...

   if ($successful) {
	$result = "success";
} else {
	$result = "Error Message Goes Here...";
}
return $result;

}

function template_ClientArea($params) {

   # Output can be returned like this, or defined via a clientarea.tpl template file (see docs for more info)

$code = '<form action="http://'.$serverip.'/controlpanel" method="post" target="_blank">
<input type="hidden" name="user" value="'.$params["username"].'" />
<input type="hidden" name="pass" value="'.$params["password"].'" />
<input type="submit" value="Login to Control Panel" />
<input type="button" value="Login to Webmail" onClick="window.open(\'http://'.$serverip.'/webmail\')" />
</form>';
return $code;

}

function template_AdminLink($params) {

$code = '<form action=\"http://'.$params["serverip"].'/controlpanel" method="post" target="_blank">
<input type="hidden" name="user" value="'.$params["serverusername"].'" />
<input type="hidden" name="pass" value="'.$params["serverpassword"].'" />
<input type="submit" value="Login to Control Panel" />
</form>';
return $code;

}

function template_LoginLink($params) {

echo "<a href=\"http://".$params["serverip"]."/controlpanel?gotousername=".$params["username"]."\" target=\"_blank\" style=\"color:#cc0000\">login to control panel</a>";

}

function template_reboot($params) {

# Code to perform reboot action goes here...

   if ($successful) {
	$result = "success";
} else {
	$result = "Error Message Goes Here...";
}
return $result;

}

function template_shutdown($params) {

# Code to perform shutdown action goes here...

   if ($successful) {
	$result = "success";
} else {
	$result = "Error Message Goes Here...";
}
return $result;

}

function template_ClientAreaCustomButtonArray() {
   $buttonarray = array(
 "Reboot Server" => "reboot",
);
return $buttonarray;
}

function template_AdminCustomButtonArray() {
   $buttonarray = array(
 "Reboot Server" => "reboot",
 "Shutdown Server" => "shutdown",
);
return $buttonarray;
}

function template_extrapage($params) {
   $pagearray = array(
    'templatefile' => 'example',
    'breadcrumb' => ' > <a href="#">Example Page</a>',
    'vars' => array(
       'var1' => 'demo1',
       'var2' => 'demo2',
    ),
   );
return $pagearray;
}

function template_UsageUpdate($params) {

$serverid = $params['serverid'];
$serverhostname = $params['serverhostname'];
$serverip = $params['serverip'];
$serverusername = $params['serverusername'];
$serverpassword = $params['serverpassword'];
$serveraccesshash = $params['serveraccesshash'];
$serversecure = $params['serversecure'];

# Run connection to retrieve usage for all domains/accounts on $serverid

# Now loop through results and update DB

foreach ($results AS $domain=>$values) {
       update_query("tblhosting",array(
        "diskused"=>$values['diskusage'],
        "dislimit"=>$values['disklimit'],
        "bwused"=>$values['bwusage'],
        "bwlimit"=>$values['bwlimit'],
        "lastupdate"=>"now()",
       ),array("server"=>$serverid,"domain"=>$values['domain']));
   }

}

function template_AdminServicesTabFields($params) {

   $result = select_query("tblsmscentova","",array("serviceid"=>$params['serviceid']));
   $data = mysql_fetch_array($result);
   $var1 = $data['var1'];
   $var2 = $data['var2'];
   $var3 = $data['var3'];
   $var4 = $data['var4'];

   $fieldsarray = array(
    'Field 1' => '<input type="text" name="modulefields[0]" size="30" value="'.$var1.'" />',
    'Field 2' => '<select name="modulefields[1]"><option>Val1</option</select>',
    'Field 3' => '<textarea name="modulefields[2]" rows="2" cols="80">'.$var3.'</textarea>',
    'Field 4' => $var4, # Info Output Only
   );
   return $fieldsarray;

}

function template_AdminServicesTabFieldsSave($params) {
   update_query("mod_customtable",array(
       "var1"=>$_POST['modulefields'][0],
       "var2"=>$_POST['modulefields'][1],
       "var3"=>$_POST['modulefields'][2],
   ),array("serviceid"=>$params['serviceid']));
}

?>

 

Is it because I did not finish the rest of the configuration and something is not playing right now with other parts? I am not sure. Please assist :(

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated