LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-08-2006, 02:05 PM   #1
latino
Member
 
Registered: Aug 2003
Location: Puerto Rico
Distribution: Centos 6.6
Posts: 142

Rep: Reputation: 15
How to convert this postnuke code into a PHP block?


Hi:

How I can make this code a 'generic' php code??

Quote:
<?php

//*************************************************************************
//* Random Unsigned Artist Block PHP-Nuke 6.5 Up *
//* 16 AUG 2005 v3.0 *
//* By: Ron Dillehay (ron@unsignedbandweb.com) *
//* http://www.unsignedbandweb.com (Unsigned Band Web) *
//* BEFORE YOU MODIFY THIS FILE READ THE LICENSE AGREEMENT! *
//*************************************************************************
//*************************************************************************
//* Random Unsigned Artist Block converted to POSTNUKE .7x+ *
//* March 6, 2005 *
//* By John Alarcon <john@alarconcepts.com> (with permisson) *
//* http://www.alarconcepts.com *
//*************************************************************************

// DO NOT ALLOW FILE TO BE LOADED BY ITSELF
// MUST EITHER LOAD VIA POSTNUKE OR ERROR OUT.
if (strpos($_SERVER['PHP_SELF'], 'randart.php')) die ('You can\'t access this file directly...');

// ASSIGN GENERAL BLOCK PROPERTIES
$blocks_modules['randart'] = array ( 'func_display' => 'blocks_randart_block',
'text_type' => 'Random Artist',
'text_type_long' => 'Random Artist Block',
'allow_multiple' => true,
'form_content' => false,
'form_refresh' => false,
'show_preview' => true
);

// ADD POSTNUKE SECURITY SCHEMA
pnSecAddSchema('Randartblock::', 'Block title::');

// MAIN FUNCTION
function blocks_randart_block($row)
{
// IF TITLE WAS LEFT EMPTY, ASSIGN IT HERE
if (empty($row['title'])) $row['title'] = 'Radio';

// CHECK TO SEE IF USER HAS ACCESS
if (!pnSecAuthAction(0, 'Randartblock::', '::', ACCESS_OVERVIEW)) return;

// START BLOCK CONTENT
$ran_box = '<div align="center"><center>';
$ran_box .= '<table width="100%" border="1" cellpadding="0" cellspacing="0"><tr><td align="left">';

// USE AN OBJECT BUFFER TO HANDLE THE FILE INCLUDE AS WELL
// AS TO AVOID PRINTING A '1" ONSCREEN WITH THE BLOCK. THIS ALSO
// ENSURES THAT THE BLOCK TITLE GOES ABOVE THE BLOCK INSTEAD OF
// UNDERNEATH IT.
ob_start();
include 'http://www.unsignedbandweb.com/music/ranking.php?mode=spotlight&header_template=abh.tpl&row_template=abr2.tpl&footer_template=abf.tpl';
$ran_box = ob_get_contents();
ob_end_clean();

// This is the (UBW) link at the bottom of the block
$ran_box .= '<tr><td align="center" valign="top"><br /><a href="http://www.unsignedbandweb.com" target="_blank"><img src="http://www.unsignedbandweb.com/images/blocks/smalllogo.jpg" border="0" alt="'._TXT_LINKBACK.'" /></a><br /><br /></td></tr>';

// CLOSE THE TABLE
$ran_box .= '</td><tr></table>';
$ran_box .= '</center></div>';
// END BLOCK CONTENT

// ASSIGN THE OUTPUT
$row['content'] = $ran_box;

// RETURN THE OUTPUT
return themesideblock($row);
}

?>
Thanks.

 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
convert shell script to c code 3saul Linux - Software 1 01-02-2006 09:40 AM
merge ASP code with PHP code.. possible ?? ALInux Programming 7 12-30-2005 08:40 AM
How to convert Assembly code to "C" source code ssg14j Programming 2 08-01-2005 12:48 PM
block of code suchi_s Programming 2 12-10-2004 03:40 PM
code to read block from the file suchi_s Programming 5 09-08-2004 06:21 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration