Install a new plugin OJS 2.4.6

I want install a new plugin “IssuePupmedXml.plugin”. but when loaded “IssuePupmedXml.plugin.tar.gz” , I see this message:
“Errors occurred processing this form:
Plugin was not successfully copied. This may be a permissions problem. Please make sure that the web server is able to write to the plugins directory (including subdirectories) but don’t forget to secure it again later.”
And I don’t know what do I do :slight_smile:
May be help me?
Thanks

Hi @zeinab,

What version of OJS are you using? (Please include this in your posts.)

Where did you get this plugin from? Can you post a link?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher
Thanks for answer
verison of my OJS is 2.4.6
and this plugin writed with a person I don’t know him. but i can share codes here

 <?php

/**
 * @file IssuePubmedXMLPlugin.inc.php
 *
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
 *
 * @class IssuePubmedXMLPlugin
 * @ingroup plugins_generic_issuepubmedxml
 *
 * @brief Adds XML link to the galley and abstract listing of issues in TOC
 */

import('classes.plugins.GenericPlugin');

class IssuePubmedXMLPlugin extends GenericPlugin {

function getName() {
	return 'IssuePubmedXMLPlugin';
}

function getDisplayName() {
	return Locale::translate('plugins.generic.issuepubmedxml.displayName');
}

function getDescription() {
	return Locale::translate('plugins.generic.issuepubmedxml.description');
}   

/**
 * Called as a plugin is registered to the registry
 * @param @category String Name of category plugin was registered to
 * @return boolean True iff plugin initialized successfully; if false,
 * 	the plugin will not be registered.
 */
function register($category, $path) {
	if (parent::register($category, $path)) {
		if ($this->getEnabled()) {
			HookRegistry::register('TemplateManager::display', array(&$this, 'templateManagerCallback'));
			HookRegistry::register('LoadHandler', array(&$this, 'handleRequest'));
		}
		$this->addLocaleData();
		return true;
	}
	return false;
}

function handleRequest($hookName, $args) {
	$page =& $args[0];
	$op =& $args[1];
	$sourceFile =& $args[2];

	$op_arr = array('viewXML');
	if ($page === 'issue' && in_array($op, $op_arr)) {
		$this->import('IssueHandler');
		Registry::set('plugin', $this);
		define('HANDLER_CLASS', 'IssueHandler');
		return true;
	}

 }

/**
 * insert message box link.
 */
function templateManagerCallback($hookName, $args) {
	$templateMgr =& $args[0]; //TemplateManager::getManager();
	$template =& $args[1];
	if ($template == 'issue/archive.tpl') {
				$templateMgr->register_outputfilter(array('IssuePubmedXMLPlugin', 'buildOutput'));
	}
	return False;
}

/** 
 * Do the work of inserting XML links.
 */	
function buildOutput($output, &$smarty) {
        $journal =& Request::getJournal();
        $templateMgr = &TemplateManager::getManager();
	$url = Request::url(null, 'issue', 'viewXML');
	// build a simulated article galley path
	$serachUrl = Request::url(null, 'issue', 'view', array('arg1'));

	// (\d+) will capture the articleId which follows abstract link
	$serachUrl = str_replace('arg1', '(\d+)', $serachUrl);
	
	// first part of url before articleId
	$url = "<a style=\"background-color:#ff6600;color:#ffffff;font-size:13px;font-weight: bold;padding-left:5px;padding-right:5px;\" href=\"$url";
	// default lable for xml output is XML
	$xml_lable = "XML";
	// if Galley Icons exists and enabled use the xml icon instead
	$galleyIconsPlugin = &PluginRegistry::getPlugin('generic', 'FileIconsPlugin');

	// is it present
	if ($galleyIconsPlugin) {
	        // is it enabled
	        if ($galleyIconsPlugin->getEnabled()) {
	                // get icons from DB
	                $iconFiles = $galleyIconsPlugin->getSetting($journal->getJournalId(), 'icons');
	                // get icons as an associatve array
	                $icons = $galleyIconsPlugin->getIcons($iconFiles);
	                // any icon for xml?
	                if (array_key_exists("xml", $icons)){
	                        // build the path to the icon
	                        $icon = $icons['xml'];
	                        $path = $templateMgr->get_template_vars('publicFilesDir') . "/icons/{$icon}";
	                        $xml_lable = "<img src='{$path}' border='0' alt='{$key}' title='{$key}' />";
	                }
	        }
	}		
	//echo preg_replace("|($serachUrl\"+>.+</a>)|", "$1 $url/$2\">$xml_lable</a>", $output);
	//return 0;
            // append to any occurence of an abstract link an XML link
	return preg_replace("|($serachUrl\"+>.+</a>)|", "$1 $url/$2\">$xml_lable</a>", $output);
}
/**
 * Determine whether or not this plugin is enabled.
 */
function getEnabled() {
	$journal = &Request::getJournal();
	if (!$journal) return false;
	return $this->getSetting($journal->getJournalId(), 'enabled');
}

/**
 * Set the enabled/disabled state of this plugin
 */
function setEnabled($enabled) {
	$journal = &Request::getJournal();
	if ($journal) {
		$this->updateSetting($journal->getJournalId(), 'enabled', $enabled ? true : false);
		return true;
	}
	return false;
}

/**
 * Display verbs for the management interface.
 */
function getManagementVerbs() {
	$verbs = array();
	if ($this->getEnabled()) {
		$verbs[] = array(
			'disable',
			Locale::translate('manager.plugins.disable')
		);
	} else {
		$verbs[] = array(
			'enable',
			Locale::translate('manager.plugins.enable')
		);
	}
	return $verbs;
}

/**
 * Perform management functions
 */
function manage($verb, $args) {

	switch ($verb) {
		case 'enable':
			$this->setEnabled(true);
			break;
		case 'disable':
			$this->setEnabled(false);
			break;
	   }
      }

     }

   ?>

and this

<?php

 /**
 * @file IssueHandler.inc.php
 *
 * Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
 *
 * @package pages.issue
 * @class IssueHandler
 *
 * Handle requests for viewXML issue functions. 
 *
 * $Id: IssueHandler.inc.php,v 1.72 2009/02/02 17:07:01 Mona Izadi Exp $
 */

import('classes.handler.Handler');

class IssueHandler extends Handler {

function viewXML($args) {
	$issueId = isset($args[0]) ? $args[0] : 0;
	PluginRegistry::loadCategory('importexport');
	$templateMgr = &TemplateManager::getManager();
	$plugin = &PluginRegistry::getPlugin('importexport', 'PubMedExportPlugin');
	$arr = array("exportIssue", $issueId);
	return $plugin->display($arr);
    }

}

?>

And there are three other code “version.xml” , “index.php” and “local.xml”. there are simple and I think not important that for copy here.

Thanks alot

Hi @zeinab,

Can you try using the forum’s code quoting features to post that? It looks like it’s gotten garbled above. This forum supports Markdown.

Regards,
Alec Smecher
Public Knowledge Project Team

I can’t understand this “quoting features”
sorry , maybe explain this?
Thank you

Hi @zeinab,

Where did you get this plugin from (i.e. is the .tar.gz downloadable from somewhere)?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher
This plugin is in one of the our websites, and I do not have access to the person who wrote this

Thank you

Hi @zeinab,

I’m afraid that I can’t help debug this unless I can see the code (and we can only invest limited time in 3rd-party code debugging). Beyond the suggestion for checking file permissions that the error message gives, I would suggest checking the code structure (e.g. the directories that the files appear in) against another plugin that installs without trouble.

Regards,
Alec Smecher
Public Knowledge Project Team