Addon install in WHM and in cPanel

lvalics

Active Member
Sep 30, 2003
26
0
151
Hi all,

I have a small script which I want to Add to Add-ons section in WHM for ADMIN and also a user part for be in cPanel.
I need some help, cause I did not saw any good documentation on this.
Any help will be appreciate.
I'm interested which files to edit, where to add links etc.
Also is important that on an update to not be overwritten.
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
31
473
Go on, have a guess
It's actually fairly simple. It's just not documented and you have to hack around to get it working.

Here's a few pointers (giving away the weeks of work I did getting this up and running) using the cPanel Pro API (so cPanel Pro needs to be installed):

1. Application in WHM itself:

Check out existing perl CGI scripts in /usr/local/cpanel/whostmgr/docroot/cgi/addon_*.cgi

2. Adding a selectable feature for cPanel accounts:

Create a new file in /usr/local/cpanel/whostmgr/addonsfeatures/ with a unique name as:

/usr/local/cpanel/whostmgr/addonsfeatures/uniquename

With:

Code:
cpanelpro_unqiuename:This is my cPanel Feature
To use that feature:

/usr/local/cpanel/base/frontend/x/cells/uniquename.html

With:

Code:
<cpanelfeature cpanelpro_uniquename>
<cpanelcell align="center" valign="top">
<td width="75" nowrap><a href="cells/uniquename/index.html"><img border="0" src="cells/uniquename/myapp.gif" width="32" height="32"></a><br>
<br>
<a href="cells/uniquename/index.html">My cPanel Feature</a></td>
</cpanelcell>
</cpanelfeature>
/usr/local/cpanel/base/frontend/x/cells/uniquename/index.html contains the calls to your application depending on how you're going to implement it. I'll leave you to work out that bit :p
 

lvalics

Active Member
Sep 30, 2003
26
0
151
TX for the help, so far I managed to work, I have some small problems still on user part with links, but I will manage it.
My strange question is, how can be done it to be applied to all skins??
I should copy in each one?
What if Admin will add a new skin?

Also on upgrade of cPanel (WHM) will be deleted this files (maybe cPanel see it as unknown.

And the last question but the last painfull ...
HOW can be that a software like cPanel with thousands of server managed with CP not have a decent API??
 

chirpy

Well-Known Member
Verifed Vendor
Jun 15, 2002
13,437
31
473
Go on, have a guess
lvalics said:
My strange question is, how can be done it to be applied to all skins??
I should copy in each one?
What if Admin will add a new skin?
The simplest way is to symlink the cells/ directory to the x theme. For example:
Code:
ln -sv /usr/local/cpanel/base/frontend/x/cells /usr/local/cpanel/base/frontend/x2/cells
ln -sv /usr/local/cpanel/base/frontend/x/cells /usr/local/cpanel/base/frontend/xmail/cells
ln -sv /usr/local/cpanel/base/frontend/x/cells /usr/local/cpanel/base/frontend/monsoon/cells
ln -sv /usr/local/cpanel/base/frontend/x/cells /usr/local/cpanel/base/frontend/bluelagoon/cells
However, that will only work if the theme supports the cPanel Pro API correctly, i.e. the following directive that appears in /usr/local/cpanel/base/frontend/x/index.html:

<cpanel dynamicinclude="cells/*.html">
 

lvalics

Active Member
Sep 30, 2003
26
0
151
Is there a way to get HASH details from somewhere if I run a local file?
We try to use Accounting.php.inc and require a hash, even from localhost, or we miss something??
 

ctrlogic

Member
Nov 4, 2008
17
0
51
It's actually fairly simple. It's just not documented and you have to hack around to get it working.

Here's a few pointers (giving away the weeks of work I did getting this up and running) using the cPanel Pro API (so cPanel Pro needs to be installed):

1. Application in WHM itself:

Check out existing perl CGI scripts in /usr/local/cpanel/whostmgr/docroot/cgi/addon_*.cgi

2. Adding a selectable feature for cPanel accounts:

Create a new file in /usr/local/cpanel/whostmgr/addonsfeatures/ with a unique name as:

/usr/local/cpanel/whostmgr/addonsfeatures/uniquename

With:

Code:
cpanelpro_unqiuename:This is my cPanel Feature
To use that feature:

/usr/local/cpanel/base/frontend/x/cells/uniquename.html

With:

Code:
<cpanelfeature cpanelpro_uniquename>
<cpanelcell align="center" valign="top">
<td width="75" nowrap><a href="cells/uniquename/index.html"><img border="0" src="cells/uniquename/myapp.gif" width="32" height="32"></a><br>
<br>
<a href="cells/uniquename/index.html">My cPanel Feature</a></td>
</cpanelcell>
</cpanelfeature>
/usr/local/cpanel/base/frontend/x/cells/uniquename/index.html contains the calls to your application depending on how you're going to implement it. I'll leave you to work out that bit :p
The thing is, maybe this thread is too old to answer my questions today, as cpanel may have changed, but I can't find a /usr/local/cpanel/base/frontend/x/cells/ directory.
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
The thing is, maybe this thread is too old to answer my questions today, as cpanel may have changed, but I can't find a /usr/local/cpanel/base/frontend/x/cells/ directory.
The frontend is for the cPanel interface. If you are looking to add a new icon to the cPanel interface, you can just use our cPanel Plugin Installation File Generator: http://cpanel.net/developer/overview.html
 

ctrlogic

Member
Nov 4, 2008
17
0
51
I have used the plugin generator already, I can see the new plugin in my customers feature list but there's no icon added in their cpanel... (Don't know why because I have browsed an icon in the generator)...
 

ctrlogic

Member
Nov 4, 2008
17
0
51
Also I can't seem to figure out, with what I've read, the difference between a plugin and an addon...
 

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
Also I can't seem to figure out, with what I've read, the difference between a plugin and an addon...
This thread is very old, so that could be assisting with the confusion. We haven't supported cPanel add-ons (not to be confused with cPAddons) for a number of years now. cPanel Plug-ins is the way to add new functionality to the cPanel interface now.
 
Last edited:

cPanelDavidG

Technical Product Specialist
Nov 29, 2006
11,212
13
313
Houston, TX
cPanel Access Level
Root Administrator
I have used the plugin generator already, I can see the new plugin in my customers feature list but there's no icon added in their cpanel... (Don't know why because I have browsed an icon in the generator)...
Try running the following command via SSH as root:

Code:
/usr/local/cpanel/bin/rebuild_sprites
 

ctrlogic

Member
Nov 4, 2008
17
0
51
[~]# /usr/local/cpanel/bin/rebuild_sprites
Searching for themes that support the cpanel plugins system....x
x3
x3mail
x2
Done
*** Rebuilding sprites for x3 ***
-=- Processing Branding Dir: /usr/local/cpanel/base/frontend/x3/branding ([root]) -=-
Sprite Image (30,1702) file = /usr/local/cpanel/base/frontend/x3/branding/icon_sprites_img_scale_60percent.png
Spite: method=scale_60percent,format=png,imgtype=icon,subtype=img....90....Done
Sprite Image (52,3049) file = /usr/local/cpanel/base/frontend/x3/branding/icon_sprites_img.jpg
Spite: format=jpg,compression=95,imgtype=icon,subtype=img....90....Done
Sprite Image (1,2249) file = /usr/local/cpanel/base/frontend/x3/branding/ui_sprites_bg_snap_to_smallest_width.png
Spite: subtype=bg,imgtype=ui,method=snap_to_smallest_width,format=png....6....Done
Sprite Image (9,48) file = /usr/local/cpanel/base/frontend/x3/branding/ui_sprites_img_skip_filetype_gif.jpg
Spite: subtype=img,imgtype=ui,method=skip_filetype_gif,format=jpg,compression=95....2....Done
Sprite Image (32,175) file = /usr/local/cpanel/base/frontend/x3/branding/ui_sprites_img_only_filetype_gif.gif
Spite: subtype=img,imgtype=ui,method=only_filetype_gif,format=gif....9....Done
-=- Processing Branding Dir: /usr/local/cpanel/base/frontend/x3/branding/black_ice (black_ice) -=-
Sprite Image (6,2249) file = /usr/local/cpanel/base/frontend/x3/branding/black_ice/ui_sprites_bg_snap_to_smallest_width.png
Spite: subtype=bg,imgtype=ui,method=snap_to_smallest_width,format=png....6....Done
-=- Processing Branding Dir: /usr/local/cpanel/base/frontend/x3/branding/sundaymorning (sundaymorning) -=-
Sprite Image (1,2246) file = /usr/local/cpanel/base/frontend/x3/branding/sundaymorning/ui_sprites_bg_snap_to_smallest_width.png
Spite: subtype=bg,imgtype=ui,method=snap_to_smallest_width,format=png....6....Done
Sprite Image (9,48) file = /usr/local/cpanel/base/frontend/x3/branding/sundaymorning/ui_sprites_img_skip_filetype_gif.jpg
Spite: subtype=img,imgtype=ui,method=skip_filetype_gif,format=jpg,compression=95....2....Done
Sprite Image (32,175) file = /usr/local/cpanel/base/frontend/x3/branding/sundaymorning/ui_sprites_img_only_filetype_gif.gif
Spite: subtype=img,imgtype=ui,method=only_filetype_gif,format=gif....9....Done
-=- Processing Branding Dir: /usr/local/cpanel/base/frontend/x3/branding/x (x) -=-
Sprite Image (36,1690) file = /usr/local/cpanel/base/frontend/x3/branding/x/icon_sprites_img_scale_60percent.png
Spite: method=scale_60percent,format=png,imgtype=icon,subtype=img....90....Done
Sprite Image (62,3028) file = /usr/local/cpanel/base/frontend/x3/branding/x/icon_sprites_img.jpg
Spite: format=jpg,compression=95,imgtype=icon,subtype=img....90....Done
-=- Processing Branding Dir: /usr/local/cpanel/base/frontend/x3/branding/crimson_smoke (crimson_smoke) -=-
Sprite Image (6,2249) file = /usr/local/cpanel/base/frontend/x3/branding/crimson_smoke/ui_sprites_bg_snap_to_smallest_width.png
Spite: subtype=bg,imgtype=ui,method=snap_to_smallest_width,format=png....6....Done
Sprite Image (9,48) file = /usr/local/cpanel/base/frontend/x3/branding/crimson_smoke/ui_sprites_img_skip_filetype_gif.jpg
Spite: subtype=img,imgtype=ui,method=skip_filetype_gif,format=jpg,compression=95....2....Done
Sprite Image (32,175) file = /usr/local/cpanel/base/frontend/x3/branding/crimson_smoke/ui_sprites_img_only_filetype_gif.gif
Spite: subtype=img,imgtype=ui,method=only_filetype_gif,format=gif....9....Done
-=- Processing Branding Dir: /usr/local/cpanel/base/frontend/x3/branding/business2business (business2business) -=-
Sprite Image (2,2373) file = /usr/local/cpanel/base/frontend/x3/branding/business2business/ui_sprites_bg_snap_to_smallest_width.png
Spite: subtype=bg,imgtype=ui,method=snap_to_smallest_width,format=png....6....Done
Sprite Image (9,48) file = /usr/local/cpanel/base/frontend/x3/branding/business2business/ui_sprites_img_skip_filetype_gif.jpg
Spite: subtype=img,imgtype=ui,method=skip_filetype_gif,format=jpg,compression=95....2....Done
Sprite Image (32,175) file = /usr/local/cpanel/base/frontend/x3/branding/business2business/ui_sprites_img_only_filetype_gif.gif
Spite: subtype=img,imgtype=ui,method=only_filetype_gif,format=gif....9....Done
*** Done rebuilding sprites for x3 ***


*** Rebuilding sprites for x3mail ***
-=- Processing Branding Dir: /usr/local/cpanel/base/frontend/x3mail/branding ([root]) -=-
Sprite Image (27,646) file = /usr/local/cpanel/base/frontend/x3mail/branding/icon_sprites_img_scale_60percent.png
Spite: method=scale_60percent,format=png,imgtype=icon,subtype=img....34....Done
Sprite Image (48,1156) file = /usr/local/cpanel/base/frontend/x3mail/branding/icon_sprites_img.jpg
Spite: format=jpg,compression=95,imgtype=icon,subtype=img....34....Done
Sprite Image (9,48) file = /usr/local/cpanel/base/frontend/x3mail/branding/ui_sprites_img_skip_filetype_gif.jpg
Spite: subtype=img,imgtype=ui,method=skip_filetype_gif,format=jpg,compression=95....2....Done
Sprite Image (20,111) file = /usr/local/cpanel/base/frontend/x3mail/branding/ui_sprites_img_only_filetype_gif.gif
Spite: subtype=img,imgtype=ui,method=only_filetype_gif,format=gif....7....Done
-=- Processing Branding Dir: /usr/local/cpanel/base/frontend/x3mail/branding/sundaymorning (sundaymorning) -=-
Sprite Image (9,48) file = /usr/local/cpanel/base/frontend/x3mail/branding/sundaymorning/ui_sprites_img_skip_filetype_gif.jpg
Spite: subtype=img,imgtype=ui,method=skip_filetype_gif,format=jpg,compression=95....2....Done
Sprite Image (20,111) file = /usr/local/cpanel/base/frontend/x3mail/branding/sundaymorning/ui_sprites_img_only_filetype_gif.gif
Spite: subtype=img,imgtype=ui,method=only_filetype_gif,format=gif....7....Done
-=- Processing Branding Dir: /usr/local/cpanel/base/frontend/x3mail/branding/x (x) -=-
Sprite Image (27,642) file = /usr/local/cpanel/base/frontend/x3mail/branding/x/icon_sprites_img_scale_60percent.png
Spite: method=scale_60percent,format=png,imgtype=icon,subtype=img....34....Done
Sprite Image (48,1149) file = /usr/local/cpanel/base/frontend/x3mail/branding/x/icon_sprites_img.jpg
Spite: format=jpg,compression=95,imgtype=icon,subtype=img....34....Done
-=- Processing Branding Dir: /usr/local/cpanel/base/frontend/x3mail/branding/crimson_smoke (crimson_smoke) -=-
Sprite Image (9,48) file = /usr/local/cpanel/base/frontend/x3mail/branding/crimson_smoke/ui_sprites_img_skip_filetype_gif.jpg
Spite: subtype=img,imgtype=ui,method=skip_filetype_gif,format=jpg,compression=95....2....Done
Sprite Image (20,111) file = /usr/local/cpanel/base/frontend/x3mail/branding/crimson_smoke/ui_sprites_img_only_filetype_gif.gif
Spite: subtype=img,imgtype=ui,method=only_filetype_gif,format=gif....7....Done
-=- Processing Branding Dir: /usr/local/cpanel/base/frontend/x3mail/branding/business2business (business2business) -=-
Sprite Image (9,48) file = /usr/local/cpanel/base/frontend/x3mail/branding/business2business/ui_sprites_img_skip_filetype_gif.jpg
Spite: subtype=img,imgtype=ui,method=skip_filetype_gif,format=jpg,compression=95....2....Done
Sprite Image (20,111) file = /usr/local/cpanel/base/frontend/x3mail/branding/business2business/ui_sprites_img_only_filetype_gif.gif
Spite: subtype=img,imgtype=ui,method=only_filetype_gif,format=gif....7....Done
*** Done rebuilding sprites for x3mail ***


Rebuild Complete
Still nothing available in their cpanel

Ant by the way thanks for helping me with this :)