Skip to content

Commit

Permalink
git-svn-id: http://svn.webgroupmedia.com/cerb4/cerb4@873 58cff151-b72…
Browse files Browse the repository at this point in the history
…2-0410-b014-f78a459f8f02
  • Loading branch information
jstanden committed Feb 17, 2009
1 parent 478d6f0 commit 39c141a
Show file tree
Hide file tree
Showing 43 changed files with 271 additions and 175 deletions.
1 change: 1 addition & 0 deletions ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
$request = DevblocksPlatform::readRequest();

DevblocksPlatform::init();
DevblocksPlatform::setExtensionDelegate('C4_DevblocksExtensionDelegate');

$session = DevblocksPlatform::getSessionService();
$settings = CerberusSettings::getInstance();
Expand Down
29 changes: 23 additions & 6 deletions api/Application.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
* and Joe Geck.
* WEBGROUP MEDIA LLC. - Developers of Cerberus Helpdesk
*/
define("APP_BUILD", 872);
define("APP_BUILD", 873);
define("APP_MAIL_PATH", realpath(APP_PATH . '/storage/mail') . DIRECTORY_SEPARATOR);

include_once(APP_PATH . "/api/DAO.class.php");
Expand Down Expand Up @@ -604,8 +604,8 @@ public static function getInstance() {
return $license;
}

public static function validate($key) {
/* */foreach(array('L0NvbXBhbnk6ICguKikv'=>'b','L0VtYWlsOiAoLiopLw=='=>'c','L1VzZXJzOiAoLiopLw=='=>'d','L1NlcmlhbDogKC4qKS8='=>'s') as $k=>$v)@preg_match(base64_decode($k),$key,$matches)?@$$v=trim($matches[1]):null;@$r=array('name'=>$b,'email'=>$c,'users'=>intval($d),'serial'=>$s);foreach(array(chr(97)=>0,chr(101)=>3) as $k=>$v)if(@substr(str_replace('-','',$s),0,1).@substr(str_replace('-','',$s),4,1).@substr(str_replace('-','',$s),8,1)==@substr(strtoupper(md5(@substr($b,0,1).@substr($b,-1,1).@strlen($b).$d.@substr($c,0,1).@substr($c,-1,1).@strlen($c))),$v,3))@$r[$k]=$s;return $r;/*
public static function validate($key, $email) {
/* */foreach(array('L0NvbXBhbnk6ICguKikv'=>'b','L1VzZXJzOiAoLiopLw=='=>'d','L1NlcmlhbDogKC4qKS8='=>'s') as $k=>$v)@preg_match(base64_decode($k),$key,$matches)?@$$v=trim($matches[1]):null;@$r=array('name'=>$b,'email'=>$email,'users'=>intval($d),'serial'=>$s);foreach(array(chr(97)=>0,chr(101)=>3) as $k=>$v)if(@substr(str_replace('-','',$s),0,1).@substr(str_replace('-','',$s),4,1).@substr(str_replace('-','',$s),8,1)==@substr(strtoupper(md5(@substr($b,0,1).@substr($b,-1,1).@strlen($b).$d.@substr($email,0,1).@substr($email,4,1).@strlen($email))),$v,3))@$r[$k]=$s;return $r;/*
* we're sure being generous here! [TODO]
*/
$lines = split("\n", $key);
Expand All @@ -617,9 +617,9 @@ public static function validate($key) {
return (!empty($key))
? array(
'name' => (list($k,$v)=split(":",$lines[1]))?trim($v):null,
'email' => (list($k,$v)=split(":",$lines[2]))?trim($v):null,
'users' => (list($k,$v)=split(":",$lines[3]))?trim($v):null,
'serial' => (list($k,$v)=split(":",$lines[4]))?trim($v):null,
'email' => $email,
'users' => (list($k,$v)=split(":",$lines[2]))?trim($v):null,
'serial' => (list($k,$v)=split(":",$lines[3]))?trim($v):null,
'date' => time()
)
: null;
Expand Down Expand Up @@ -722,3 +722,20 @@ public function get($key,$default=null) {
return $default;
}
};

// [TODO] This gets called a lot when it happens after the registry cache
class C4_DevblocksExtensionDelegate implements DevblocksExtensionDelegate {
static function shouldLoadExtension(DevblocksExtensionManifest $extension_manifest) {
// Always allow core
if("cerberusweb.core" == $extension_manifest->plugin_id)
return true;

// [TODO] This should limit to just things we can run with no session
// Community Tools, Cron/Update. They are still limited by their own
// isVisible() otherwise.
if(null == ($active_worker = CerberusApplication::getActiveWorker()))
return true;

return $active_worker->hasPriv('plugin.'.$extension_manifest->plugin_id);
}
};
8 changes: 5 additions & 3 deletions api/DAO.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -897,17 +897,19 @@ static function setRolePrivileges($role_id, $privileges) {

// Set ACLs according to the new master list
if(!empty($privileges) && !empty($acl)) {
foreach($acl as $priv) { /* @var $priv DevblocksAclPrivilege */
foreach($privileges as $priv) { /* @var $priv DevblocksAclPrivilege */
$sql = sprintf("INSERT INTO worker_role_acl (role_id, priv_id, has_priv) ".
"VALUES (%d, %s, %d)",
$role_id,
$db->qstr($priv->id),
(false !== array_search($priv->id,$privileges) ? 1 : 0)
$db->qstr($priv),
1
);
$db->Execute($sql);
}
}

unset($privileges);

self::clearCache();
}

Expand Down
1 change: 1 addition & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
require(APP_PATH . '/api/Application.class.php');

DevblocksPlatform::init();
DevblocksPlatform::setExtensionDelegate('C4_DevblocksExtensionDelegate');

// Request
$request = DevblocksPlatform::readRequest();
Expand Down
3 changes: 1 addition & 2 deletions plugins/cerberusweb.calls/templates/calls/view.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
<td nowrap="nowrap" class="tableThBlue">{$view->name} {if $view->id == 'search'}<a href="#{$view->id}_actions" style="color:rgb(255,255,255);font-size:11px;">{$translate->_('views.jump_to_actions')}</a>{/if}</td>
<td nowrap="nowrap" class="tableThBlue" align="right">
<a href="javascript:;" onclick="genericAjaxGet('customize{$view->id}','c=internal&a=viewCustomize&id={$view->id}');toggleDiv('customize{$view->id}','block');" class="tableThLink">{$translate->_('common.customize')|lower}</a>
<span style="font-size:12px"> | </span><a href="javascript:;" onclick="genericAjaxGet('{$view->id}_tips','c=internal&a=viewShowCopy&view_id={$view->id}');toggleDiv('{$view->id}_tips','block');" class="tableThLink">{$translate->_('common.copy')|lower}</a>
{if $active_worker->hasPriv('core.home.workspaces')}<span style="font-size:12px"> | </span><a href="javascript:;" onclick="genericAjaxGet('{$view->id}_tips','c=internal&a=viewShowCopy&view_id={$view->id}');toggleDiv('{$view->id}_tips','block');" class="tableThLink">{$translate->_('common.copy')|lower}</a>{/if}
<span style="font-size:12px"> | </span><a href="javascript:;" onclick="genericAjaxGet('view{$view->id}','c=internal&a=viewRefresh&id={$view->id}');" class="tableThLink"><img src="{devblocks_url}c=resource&p=cerberusweb.core&f=images/refresh.gif{/devblocks_url}" border="0" align="absmiddle" title="{$translate->_('common.refresh')|lower}" alt="{$translate->_('common.refresh')|lower}"></a>
{*<span style="font-size:12px"> | </span><a href="javascript:;" onclick="genericAjaxGet('{$view->id}_tips','c=tickets&a=showViewRss&view_id={$view->id}&source=core.rss.source.task');toggleDiv('{$view->id}_tips','block');" class="tableThLink"><img src="{devblocks_url}c=resource&p=cerberusweb.core&f=images/feed-icon-16x16.gif{/devblocks_url}" border="0" align="absmiddle"></a>*}
</td>
</tr>
</table>
Expand Down
5 changes: 3 additions & 2 deletions plugins/cerberusweb.core/classes.php
Original file line number Diff line number Diff line change
Expand Up @@ -4220,6 +4220,7 @@ function saveLicensesAction() {
}

@$key = DevblocksPlatform::importGPC($_POST['key'],'string','');
@$email = DevblocksPlatform::importGPC($_POST['email'],'string','');
@$do_delete = DevblocksPlatform::importGPC($_POST['do_delete'],'integer',0);

if(DEMO_MODE) {
Expand All @@ -4233,12 +4234,12 @@ function saveLicensesAction() {
return;
}

if(empty($key)) {
if(empty($key) || empty($email)) {
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config','settings','empty')));
return;
}

if(null==($valid = CerberusLicense::validate($key)) || 5!=count($valid)) {
if(null==($valid = CerberusLicense::validate($key,$email)) || 5!=count($valid)) {
DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config','settings','invalid')));
return;
}
Expand Down
11 changes: 10 additions & 1 deletion plugins/cerberusweb.core/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
<acl>
<!-- Addy Book -->
<priv id="core.addybook" label="acl.core.addybook" />
<priv id="core.addybook.view.actions.export" label="acl.core.addybook.view.actions.export" />
<priv id="core.addybook.addy.view.actions.export" label="acl.core.addybook.addy.view.actions.export" />
<priv id="core.addybook.org.view.actions.export" label="acl.core.addybook.org.view.actions.export" />

<!-- Display Ticket -->
<priv id="core.display.actions.attachments.download" label="acl.core.display.actions.attachments.download" />
Expand All @@ -105,6 +106,9 @@
<!-- RSS -->
<priv id="core.rss" label="acl.core.rss" />

<!-- Tickets -->
<priv id="core.tasks.view.actions.export" label="acl.core.tasks.view.actions.export" />

<!-- Tickets -->
<priv id="core.ticket.actions.assign" label="acl.core.ticket.actions.assign" />
<priv id="core.ticket.actions.close" label="acl.core.ticket.actions.close" />
Expand All @@ -115,6 +119,11 @@
<priv id="core.ticket.view.actions.export" label="acl.core.ticket.view.actions.export" />
<priv id="core.ticket.view.actions.merge" label="acl.core.ticket.view.actions.merge" />
<priv id="core.ticket.view.actions.pile_sort" label="acl.core.ticket.view.actions.pile_sort" />

<!-- Workspaces -->
<priv id="core.home.auto_refresh" label="acl.core.home.auto_refresh" />
<priv id="core.home.workspaces" label="acl.core.home.workspaces" />

</acl>

<!-- Extensions -->
Expand Down
24 changes: 19 additions & 5 deletions plugins/cerberusweb.core/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,11 @@
<tu tuid='acl.core.addybook'>
<tuv xml:lang="en_US"><seg>[Address Book] Can browse the address book</seg></tuv>
</tu>
<tu tuid='acl.core.addybook.view.actions.export'>
<tuv xml:lang="en_US"><seg>[Address Book] Can export lists to CSV/XML</seg></tuv>
<tu tuid='acl.core.addybook.addy.view.actions.export'>
<tuv xml:lang="en_US"><seg>[Address Book] Can export e-mail address lists to CSV/XML</seg></tuv>
</tu>
<tu tuid='acl.core.addybook.org.view.actions.export'>
<tuv xml:lang="en_US"><seg>[Address Book] Can export organization lists to CSV/XML</seg></tuv>
</tu>

<!-- Display Ticket -->
Expand All @@ -316,6 +319,14 @@
<tuv xml:lang="en_US"><seg>[Display Ticket] Can split tickets</seg></tuv>
</tu>

<!-- Home -->
<tu tuid='acl.core.home.auto_refresh'>
<tuv xml:lang="en_US"><seg>[Home] Can auto-refresh on the Home page</seg></tuv>
</tu>
<tu tuid='acl.core.home.workspaces'>
<tuv xml:lang="en_US"><seg>[Home] Can build private workspaces and worklists</seg></tuv>
</tu>

<!-- Knowledgebase -->
<tu tuid='acl.core.kb'>
<tuv xml:lang="en_US"><seg>[Knowledgebase] Can view the knowledgebase</seg></tuv>
Expand Down Expand Up @@ -343,6 +354,11 @@
<tuv xml:lang="en_US"><seg>[RSS] Can export lists as RSS feeds</seg></tuv>
</tu>

<!-- Tasks -->
<tu tuid='acl.core.tasks.view.actions.export'>
<tuv xml:lang="en_US"><seg>[Tasks] Can export task lists to CSV/XML</seg></tuv>
</tu>

<!-- Tickets -->
<tu tuid='acl.core.ticket.actions.assign'>
<tuv xml:lang="en_US"><seg>[Tickets] Can assign tickets to other workers</seg></tuv>
Expand Down Expand Up @@ -371,9 +387,7 @@
<tu tuid='acl.core.ticket.view.actions.pile_sort'>
<tuv xml:lang="en_US"><seg>[Tickets] Can use the pile sorter on lists</seg></tuv>
</tu>




<!-- Addresses -->

<tu tuid='address.id'>
Expand Down
4 changes: 2 additions & 2 deletions plugins/cerberusweb.core/templates/activity/index.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
var tabView = new YAHOO.widget.TabView();
{/literal}
{foreach from=$tab_manifests item=tab_manifest}
{foreach from=$tab_manifests item=tab_manifest}
{literal}tabView.addTab( new YAHOO.widget.Tab({{/literal}
label: '{$tab_manifest->params.title|devblocks_translate|escape:'quotes'}',
dataSrc: '{devblocks_url}ajax.php?c=activity&a=showTab&ext_id={$tab_manifest->id}{/devblocks_url}',
{if $tab_selected==$tab_manifest->params.uri}active: true,{/if}
cacheData: false
{literal}}));{/literal}
{literal}}));{/literal}
{/foreach}
tabView.appendTo('activityOptions');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,24 @@
<td width="100%" valign="top" colspan="2">
{foreach from=$plugins item=plugin key=plugin_id}
{if $plugin->enabled}
{assign var=show_plugin value=0}
{foreach from=$acl item=priv key=priv_id}{if $priv->plugin_id==$plugin_id}{assign var=show_plugin value=1}{/if}{/foreach}

{if $show_plugin}
{assign var=plugin_priv value="plugin."|cat:$plugin_id}
<div style="margin-left:10px;background-color:rgb(255,255,221);border:2px solid rgb(255,215,0);padding:2px;margin-bottom:10px;">
<b>{$plugin->name}</b><br>
<a href="javascript:;" style="padding-left:10px;font-size:90%;" onclick="checkAll('privs{$plugin_id}');">{$translate->_('check all')|lower}</a>
<div id="privs{$plugin_id}" style="margin-top:5px;margin-bottom:5px;">
{foreach from=$acl item=priv key=priv_id}
{if $priv->plugin_id==$plugin_id}
<label style="padding-left:10px;"><input type="checkbox" name="acl_privs[]" value="{$priv_id}" {if isset($role_privs.$priv_id)}checked{/if}> {$priv->label|devblocks_translate}</label><br>
{/if}
{/foreach}
</div>
</div>
<label>
{if $plugin->id=="cerberusweb.core"}
<input type="hidden" name="acl_privs[]" value="plugin.cerberusweb.core">
{else}
<input type="checkbox" name="acl_privs[]" value="{$plugin_priv|escape}" {if isset($role_privs.$plugin_priv)}checked="checked"{/if} onchange="toggleDiv('privs{$plugin_id}',(this.checked)?'block':'none');">
{/if}
<b>{$plugin->name}</b></label><br>
<div id="privs{$plugin_id}" style="padding-left:10px;margin-bottom:5px;display:{if $plugin->id=="cerberusweb.core" || isset($role_privs.$plugin_priv)}block{else}none{/if}">
<a href="javascript:;" style="font-size:90%;" onclick="checkAll('privs{$plugin_id}');">{$translate->_('check all')|lower}</a><br>
{foreach from=$acl item=priv key=priv_id}
{if $priv->plugin_id==$plugin_id}
<label style=""><input type="checkbox" name="acl_privs[]" value="{$priv_id}" {if isset($role_privs.$priv_id)}checked{/if}> {$priv->label|devblocks_translate}</label><br>
{/if}
{/foreach}
</div>
</div>
{/if}
{/foreach}
</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Data: <b>{$total_db_data} MB</b><br>
Indexes: <b>{$total_db_indexes} MB</b><br>
Total Disk Space: <b>{$total_db_size} MB</b><br>
<br>
Running an OPTIMIZE on the database would free up about <b>{$total_db_slack} MB</b><br>
Running an OPTIMIZE on the database would free about <b>{$total_db_slack} MB</b><br>
<br>

<h3>Attachments:</h3>
Expand Down Expand Up @@ -76,6 +76,12 @@ Total Disk Space: <b>{$total_file_size} MB</b><br>
<td align="right"><b>Licensed to:</b></td>
<td>{$license.name}</td>
</tr>
{if $license.email}
<tr>
<td align="right"><b>E-mail:</b></td>
<td>{$license.email}</td>
</tr>
{/if}
<tr>
<td align="right"><b>Serial Number:</b></td>
<td>{$license.serial}</td>
Expand All @@ -96,10 +102,15 @@ Total Disk Space: <b>{$total_file_size} MB</b><br>
<input type="hidden" name="c" value="config">
<input type="hidden" name="a" value="saveLicenses">
<input type="hidden" name="do_delete" value="0">

<b>Enter the e-mail address from your order:</b></br>
<input type="text" name="email" size="45" value=""><br>
<br>

<b>Paste the license information you received with your order:</b><br>
<textarea rows="8" cols="80" name="key"></textarea><br>
<br>
<br>

<button type="submit"><img src="{devblocks_url}c=resource&p=cerberusweb.core&f=images/check.gif{/devblocks_url}" align="top"> {$translate->_('common.save_changes')|capitalize}</button>
<button type="button" onclick="if(confirm('Are you sure you want to remove your license?')){literal}{{/literal}this.form.do_delete.value='1';this.form.submit();{literal}}{/literal}"><img src="{devblocks_url}c=resource&p=cerberusweb.core&f=images/document_delete.gif{/devblocks_url}" align="top"> Clear License</button>
Expand Down
Loading

0 comments on commit 39c141a

Please sign in to comment.