Scribd Document Viewer Plugin Scribd Document Viewer Plugin
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Scribd Document Viewer Plugin

Started by Abbas Ali, August 13, 2008, 02:37:39 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Abbas Ali

You have quite a few documents (txt, doc, pdf etc..) in your gallery? and you want to display them in a better way? If yes then this is the plugin for you.

For those of you who are not familiar with Scribd, take a look at this. This is how you can display the documents in your coppermine installation too. Here is a working demo after installing the plugin.

First you will have to register an account on Scribd and get the API key and secret phrase. You can do so from here.

After you get the API key and secret phrase install the attached plugin and your are all done.

Unfortunately cpg lacks a few plugin hooks which is needed by this plugin, So you will have to add those hooks manually i.e. you will have to add a few lines of code manually before installing the plugin.

Edit include/picmgmt.inc.php (function add_picture)
Add


    $CURRENT_PIC_DATA['pid'] = mysql_insert_id();
    CPGPluginAPI::filter('add_file_data_success',$CURRENT_PIC_DATA);


just before


    return $result;
}


Edit delete.php (function delete_picture)
Add


    $pic['pid'] = $pid;
    CPGPluginAPI::filter('before_delete_file', $pic);


just before


    $query = "DELETE FROM {$CONFIG['TABLE_PICTURES']} WHERE pid='$pid' LIMIT 1";
    $result = cpg_db_query($query);


Edit editpics.php (function process_post_data)

Add


       $pic['pid'] = $pid;
       CPGPluginAPI::filter('before_delete_file', $pic);


just before


                        $query = "DELETE FROM {$CONFIG['TABLE_PICTURES']} WHERE pid='$pid' LIMIT 1";
                        $result = cpg_db_query($query);


Thats it. After making the above changes you can install the plugin. The configure screen of plugin will ask you the Scribd API key and Secret phrase.

Supported formats are txt, doc, ppt, xls, pdf and rtf

Note:

  • The plugin requires PHP 5 and CURL
  • Only documents uploaded after installing the plugin will be converted to Sribd. All older documents will continue to be displayed in normal way.
  • All the documents you upload to your cpg installation will also be copied to scribd server.
  • After you uninstall the plugin, the copies from scribd server will not get deleted. You will have to do that manually by visiting their site.

Cheers,
Abbas
Chief Geek at Ranium Systems

Joachim Müller

Wow, that's cool. Are you going to add the "missing" hooks to cpg1.5.x, so it can be used with that version easily?

Abbas Ali

Yes i will. Actually i was thinking to add them in cpg14x as well. Perhaps i will create a separate thread to discuss this.
Chief Geek at Ranium Systems

valsg

Indeed this is a great plugin :) I am however experiencing a strange issue with it. The plugin itself is working wonderfully alone but as soon as a bridge is installed, any newly uploaded file is not processed by it but instead is displayed regularly. I first noticed this after installing the phpBB3 bridge and thought this might be because of the bridge itself thus had it uninstalled. Once uninstalled, scribd plugin started working fine again and processed newly uploaded files correctly. I have then installed the SMF bridge and again, scribd plugin stopped processing new files.

Am I missing something and is there any way I can make the plugin work with either phpBB3 or SMF bridged? I guess this might be due to the custom hooks that I had to add to the files as described in th post above, but since I don't really know the code that well, I can't determine what might be causing it. Any help on that topic will be appreciated.

Thank you in advance!

Myles

I have the same problem as in the above post.
The plugin works perfectly, but when I enable my bridge with phpbb3 the plugin is disabled. I have also bridged with SMF and the same thing happened. I'd be grateful if someone else would try it too.
Here is the site (the bridges are currently disabled so that I can make use of the plugin):

www.isbcreative.org 


For info: it's a school site and we are aiming for students to be able to upload their work to the gallery and also discuss it in a bridged forum. Ideally, I'd also like to include a bridge with b2evolution, which would create something quite special. So any help with this will be much appreciated.

Nibbler

Edit codebase.php, find


// We will only consider those extenstions which are supported by Scribd
global $scribd_valid_extensions;
$scribd_valid_extensions = array('pdf', 'txt', 'rtf', 'ppt', 'doc', 'xls');


Change to


// Add page_start action
$thisplugin->add_action('page_start', 'scribd_init');

function scribd_init()
{
    // We will only consider those extenstions which are supported by Scribd
    global $scribd_valid_extensions;
    $scribd_valid_extensions = array('pdf', 'txt', 'rtf', 'ppt', 'doc', 'xls');
}


That's the only thing I can see that might be an issue when bridging.

Myles

Thanks for your help. I have tried that, but the problem remains. (Each time I enable the smf bridge the plugin stops working.)

This is a copy of my codebase.php file as it is now http://www.isbcreative.org/test/codebase.txt