Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux indy02.toastserver.com 3.10.0-962.3.2.lve1.5.85.el7.x86_64 #1 SMP Thu Apr 18 15:18:36 UTC 2024 x86_64
User : palandch ( 1163)
PHP Version : 7.1.33
Disable Function : NONE
Directory :  /home/palandch/www/core/model/modx/processors/security/documentgroup/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/palandch/www/core/model/modx/processors/security/documentgroup/updatedocumentsin.php
<?php
/**
 * Update documents in a resource group
 *
 *
 * @package modx
 * @subpackage processors.security.documentgroup
 */
if (!$modx->hasPermission('access_permissions')) return $modx->error->failure($modx->lexicon('permission_denied'));
$modx->lexicon->load('resource','access');

/* format data */
$scriptProperties['resource'] = substr(strrchr($scriptProperties['resource'],'_'),1);
$scriptProperties['resource_group'] = substr(strrchr($scriptProperties['resource_group'],'_'),1);

if (empty($scriptProperties['resource']) || empty($scriptProperties['resource_group'])) return $modx->error->failure('Invalid data.');

/* get resource */
$resource = $modx->getObject('modResource',$scriptProperties['resource']);
if ($resource == null) return $modx->error->failure($modx->lexicon('resource_err_nfs',array('id' => $scriptProperties['resource'])));

/* get resource group */
$resourceGroup = $modx->getObject('modResourceGroup',$scriptProperties['resource_group']);
if ($resourceGroup == null) return $modx->error->failure($modx->lexicon('resource_group_err_ns'));

/* check to make sure already isnt in group */
$alreadyExists = $modx->getObject('modResourceGroupResource',array(
	'document' => $resource->get('id'),
	'document_group' => $resourceGroup->get('id'),
));
if ($alreadyExists) return $modx->error->failure($modx->lexicon('resource_group_resource_err_ae'));

/* create resource group -> resource pairing */
$resourceGroupResource = $modx->newObject('modResourceGroupResource');
$resourceGroupResource->set('document',$resource->get('id'));
$resourceGroupResource->set('document_group',$resourceGroup->get('id'));

if ($resourceGroupResource->save() == false) {
    return $modx->error->failure($modx->lexicon('resource_group_resource_err_create'));
}

return $modx->error->success('',$resourceGroupResource);

Spamworldpro Mini