Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
transit
Regular
Regular


Joined: Jun 01, 2010
Posts: 69

PostPosted: Mon Jun 14, 2010 1:53 pm Reply with quote

I have come to a cross roads with my buisness website now, where I have everything I need from the RN CMS however the one lacking area is the Content section. Now I don't mind framing inside other php scripts I just wanted to know if any of you have seen anything like the below sites before:
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login!

A way for me to have small boxes in a listing setting with options for expandable pages etc. With the possibility of sub categories etc. Really gives me a way to put content out for clients of my website.

If you have any thoughts or have seen any PHP/Related scripts that I could use please feel free to post here!

P.S. Unfortunately I don't think the 2.2.2 of the Content Plus will be out anytime soon so I dont think the 2.2.1 will suffice for my needs Sad
 
View user's profile Send private message
jestrella
Moderator


Joined: Dec 01, 2005
Posts: 593
Location: Santiago, Dominican Republic

PostPosted: Tue Jun 15, 2010 5:36 pm Reply with quote

Version 2.2.2 of Content Plus is the one distributed within RavenNuke 2.4.x itself. Subcategories is the wishlist for an upcoming major version of CP... And don't get the idea on the small boxes thing, please briefly explain it as I might be a lil retarded today Laughing Laughing Laughing

_________________
"For those whom have not reach the sky... Every mountain seems high"

Best Regards
Jonathan Estrella Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
transit
PostPosted: Tue Jun 15, 2010 8:44 pm Reply with quote

Take a look at what I did today. Kemana is a good directory script. Too bad it couldnt be ported over to nuke Sad
Only registered users can see links on this board! Get registered or login!

Edit: Why does it say on the Slaytanic sitethat Content 2.2.1 is the only one released and that 2.2.2 would provide sub-categories? I thought it must have been a typo when I read it in the RN copyright.
 
jestrella
PostPosted: Tue Jun 15, 2010 10:24 pm Reply with quote

Subcategories will be for next major version, 2.2.x series are bugfix releases. As 2.2.2 have some RN specific code I have not publicly released it.

Seems to me that NukeC is a closer approach of what you are looking for, find it on Only registered users can see links on this board! Get registered or login!
 
transit
PostPosted: Wed Jun 16, 2010 1:26 pm Reply with quote

Well actually I got Kemana to work out perfectly I think I will post the results when I finish up with it.

Anyways I was wondering how this would work. The Kemana is a seperate portalish site kind of like a standalone coppermine if you were to think of it like that. Now there are only a limited number of php files it accesses so I need to add some lines of code so that I can wrap my theme around it?

Im guessing something like ../

includes("../mainfile.php) or something needs to be added?
 
jestrella
PostPosted: Wed Jun 16, 2010 6:16 pm Reply with quote

Something like this pseudo-code should be added, as well as some modifications to your script

include mainfile.php
include header.php
/* content goes here */
include footer.php
 
transit
PostPosted: Thu Jun 17, 2010 1:55 pm Reply with quote

So its not working like expected:

I made a folder called Directory put it into the modules folder and then activated from the RN 2.40.1 ACP.

Then i modified my index.php for the Kemana directory (which is its own portal pulling from its own database)

I then pointed to the module:
Only registered users can see links on this board! Get registered or login!

It doesnt show anything for the module as well as no footer!

Here is the index.php with the added 'include' as you requested which I just pulled from another module. Tell me what you think!

Code:


<?php

if ( !defined('MODULE_FILE') ) {
    die ('You can\'t access this file directly...');
}

if (!defined('INDEX_FILE')) define('INDEX_FILE', true); // Set to FALSE to hide right blocks

require_once('mainfile.php');

   include("header.php");

function check_backlink ()
{
   global $db_prefix;
   
   // get which dir_set requires backlink
   $f = sql_qquery ("SELECT dir_id FROM ".$db_prefix."dir_set WHERE set_backlink='1' ORDER BY RAND() LIMIT 1");
   $ds = $f[0];

   // get a url
   $row = sql_qquery ("SELECT item_id, backlink FROM ".$db_prefix."link WHERE dir_id='$ds' AND backlink_status = '0' LIMIT 1");
   if (!empty ($row))
   {
      // is it available?
      if (!empty ($row['backlink']))
      {
         $tmp = remote_fopen ($row['backlink']);
         if (empty ($tmp))
         {
            sql_query ("UPDATE ".$db_prefix."link SET backlink_status = '-1' WHERE item_id=$row[item_id] LIMIT 1");
         }
         else
         {
            if (!strpos ($tmp, html_unentities ($config['backlink_txt'])))
               sql_query ("UPDATE ".$db_prefix."link SET backlink_status = '-1' WHERE item_id=$row[item_id] LIMIT 1");
            else
               sql_query ("UPDATE ".$db_prefix."link SET backlink_status = '1' WHERE item_id=$row[item_id] LIMIT 1");
         }
      }
      else
         sql_query ("UPDATE ".$db_prefix."link SET backlink_status = '-1' WHERE item_id=$row[item_id] LIMIT 1");
   }
   else
   {
      // if no more backlink to check, reset everything back to 'unchecked'
      sql_query ("UPDATE ".$db_prefix."link SET backlink_status='0' WHERE dir_id='$ds'");
   }
}


function check_url ()
{
   global $db_prefix;

   // get which dir_set requires backlink
   $f = sql_qquery ("SELECT dir_id FROM ".$db_prefix."dir_set WHERE set_url='1' ORDER BY RAND() LIMIT 1");
   $ds = $f[0];

   // get a url
   $row = sql_qquery ("SELECT item_id, url FROM ".$db_prefix."link WHERE dir_id='$ds' AND url_status = '0' LIMIT 1");
   if (!empty ($row))
   {
      // is it available?
      if (!empty ($row['url']))
      {
         $tmp = @remote_fopen ($row['url']);
         if (empty ($tmp))
            sql_query ("UPDATE ".$db_prefix."link SET url_status = '-1' WHERE item_id=$row[item_id] LIMIT 1");
         else
            sql_query ("UPDATE ".$db_prefix."link SET url_status = '1' WHERE item_id=$row[item_id] LIMIT 1");
      }
   }
   else
   {
      // if no more backlink to check, reset everything back to 'unchecked'
      sql_query ("UPDATE ".$db_prefix."link SET url_status='0' WHERE dir_id='$ds'");
   }
}


/************************************************
 * Powered with qEngine v3 (c) C97.net
 * All rights reserved
 ************************************************/
 
// check install/
if (file_exists ('./install/'))
{
   die ('If you have just installed Kemana, please delete the <b>"install/"</b> folder on your server before using Kemana v1.4 (build 2010.04.20). Or <a href="install/index.php">'
       .'click here</a> to install Kemana for the first time.');
}

// very important file
require "./includes/user_init.php";

// close site?
if ($config['close_site']) msg_die ('site_closed');

// overwrite view mode?
$view_mode = get_param ('view_mode');
if (!empty ($view_mode))
{
   if ($view_mode == 'desktop') setcookie ($db_prefix.'view_mode', 'desktop', 0, "/");
   if ($view_mode == 'mobile') setcookie ($db_prefix.'view_mode', 'mobile', 0, "/");
   redir ();
}

// referral mode?
$ref = get_param ('ref');
if (!empty ($ref))
{
   $ip = $_SERVER['REMOTE_ADDR'];
   $row = sql_fetch_array (sql_query ("SELECT * FROM ".$db_prefix."ip_referred WHERE ref_ip = '$ip' LIMIT 1"));
   if (empty ($row['ref_ip']))
   {
       sql_query ("INSERT INTO ".$db_prefix."ip_referred VALUES ('$ip', 'refer', UNIX_TIMESTAMP())");
       sql_query ("UPDATE ".$db_prefix."user SET user_reff=user_reff+1 WHERE user_id='$ref' LIMIT 1");
   }
   redir ($config['site_url']);
}

// verify backlink? only 1 out of 10 visitors && backlink_code defined && allow http fopen
if ($config['backlink_txt'] && (mt_rand (1, 10) == 5)) check_backlink ();
if ($config['check_url'] && (mt_rand (1, 10) == 5)) check_url ();

// autoexec the following lines once each day
if ($config['last_autoexec'] != $sql_today)
{
   // send emails to soon to be expired
   $etpl = load_tpl ('mail', 'mail_expire.tpl');
   
   // only sent to: premium or sponsored, which will be expired in 7 days, has not been sent the email, and not edited (waiting for approval) links
   $last7 = convert_date ($sql_today, 'sql', 7);
   $res = sql_query ("SELECT item_id, title, short_note, t1.user_id, email, list_premium, list_sponsored, end_sponsored
   FROM ".$db_prefix."link AS t1 JOIN ".$db_prefix."user AS t2 USING (user_id)
   WHERE (list_premium = '1' OR list_sponsored='1') AND end_sponsored <= '$last7' AND exp_mailed != '1' AND old_id='0'");

   while ($row = sql_fetch_array ($res))
   {
      $row['site_url'] = $config['site_url'];
      $row['site_name'] = $config['site_name'];
      $row['end_sponsored'] = convert_date ($row['end_sponsored'], 'long');
      $body = quick_tpl ($etpl, $row);
      email ($email, $lang['l_exp_subject'], $body, 1, 1);   // send the email (logged)
      sql_query ("UPDATE ".$db_prefix."link SET exp_mailed='1' WHERE item_id='$row[item_id]' LIMIT 1"); // mark as sent
   }

   // update expired sponsore/preimum
   sql_query ("UPDATE ".$db_prefix."link SET list_regular='1', list_premium='0', list_sponsored='0' WHERE end_sponsored < '$sql_today'");
   
   // demo mode?
   if ($config['demo_mode']) { require './includes/admin_func.php'; require './reset/reset.php'; }
   
   // update autoexec
   sql_query ("UPDATE ".$db_prefix."config SET config_value='$sql_today' WHERE config_id='last_autoexec' LIMIT 1");
}

// welcome content
$outline_tpl_mode = 'welcome';
$tpl = load_tpl ('welcome.tpl');
load_tpl ('outline.tpl');

// 1. create portal pages (cached for better perfomance)
// replaced with PORTAL MODULE for maximum flexibility

// 2. create featured links
$txt['block_featured'] = ''; $i = 0; $r = $config['featured_col'];
$foo = array ('subblock_featured' => '');

// 2.1 fix featured links for single dir_set
if (!$multiple_set && empty ($config['featured_item']))
{
   $f = sql_qquery ("SELECT featured FROM ".$db_prefix."dir_set LIMIT 1");
   $config['featured_item'] = $f[0];
}

if ($config['featured_item'])
{
   $f = explode (';', $config['featured_item']);
    foreach ($f as $val)
   {
      $i++;

      $foo['featured_box'] = make_promo ($val, 'featured');
      $foo['subblock_featured'] .= quick_tpl ($tpl_subblock['featured'], $foo);

      if (!($i % $r))
      {
         $txt['block_featured'] .= quick_tpl ($tpl_block['featured'], $foo);
         $foo['subblock_featured'] = '';
      }
   }
}
if (!empty ($foo['subblock_featured'])) $txt['block_featured'] .= quick_tpl ($tpl_block['featured'], $foo);


// 3. get new link
$txt['block_new'] = ''; $i = 0; $r = $config['new_col'];
$foo = array ('subblock_new' => '');

$res = sql_query ("SELECT item_id FROM ".$db_prefix."link WHERE status='O' ORDER BY item_id DESC LIMIT $config[new_link]");
while ($row = sql_fetch_array ($res))
{
    $i++;

   $foo['new_box'] = make_promo ($row['item_id'], 'new');
   $foo['subblock_new'] .= quick_tpl ($tpl_subblock['new'], $foo);

   if (!($i % $r))
   {
      $txt['block_new'] .= quick_tpl ($tpl_block['new'], $foo);
      $foo['subblock_new'] = '';
   }
}
if (!empty ($foo['subblock_new'])) $txt['block_new'] .= quick_tpl ($tpl_block['new'], $foo);


// 4. get popular links
$txt['block_popular'] = ''; $i = 0; $r = $config['pop_col'];
$foo = array ('subblock_popular' => '');

$res = sql_query ("SELECT item_id FROM ".$db_prefix."link WHERE status='O' ORDER BY stat_hits DESC LIMIT $config[pop_link]");
while ($row = sql_fetch_array ($res))
{
    $i++;

   $foo['popular_box'] = make_promo ($row['item_id'], 'popular');
   $foo['subblock_popular'] .= quick_tpl ($tpl_subblock['popular'], $foo);

   if (!($i % $r))
   {
      $txt['block_popular'] .= quick_tpl ($tpl_block['popular'], $foo);
      $foo['subblock_popular'] = '';
   }
}
if (!empty ($foo['subblock_popular'])) $txt['block_popular'] .= quick_tpl ($tpl_block['popular'], $foo);


// 5. create featured content
$txt['block_feat_content'] = '';
$res = sql_query ("SELECT * FROM ".$db_prefix."featured ORDER BY idx");
while ($row = sql_fetch_array ($res))
{
   if (!empty ($row['feat_img']))
      $row['content'] = "<a href=\"$row[feat_url]\"><img src=\"public/image/$row[feat_img]\" alt=\"$row[feat_title]\" /></a>";
   else
      $row['content'] = $row['feat_text'];
   $txt['block_feat_content'] .= quick_tpl ($tpl_block['feat_content'], $row);
}


// 6. get old tree method (cached, and only for SINGLE DIR)
if (!$multiple_set)
{
   $s = sql_qquery ("SELECT dir_id FROM ".$db_prefix."dir_set LIMIT 1");
   $set = $s[0]; $num_sub = $config['cat_all_sub'] + 1;

   $txt['block_cat_all'] = qcache_get ('dir_'.$set);
   if (!$txt['block_cat_all'])
   {
      $i = 0; $r = $config['cat_all_col'];
      $foo = array ('subblock_cat_all' => '');

      $res = sql_query ("SELECT cat_id, cat_name, cat_num_links FROM ".$db_prefix."category WHERE dir_id='$set' AND parent='0' ORDER BY cat_name");
      while ($row = sql_fetch_array ($res))
      {
         $i++;
         $foo['cat_name'] = $row['cat_name'];
         $foo['cat_id'] = $row['cat_id'];
         $foo['cat_num'] = num_format ($row['cat_num_links']);
         $foo['subcat'] = '';
   
         // --- get subcat
         $j = 0; $fs = array ();
         $res2 = sql_query ("SELECT cat_id, cat_name, cat_num_links FROM ".$db_prefix."category WHERE parent='$row[cat_id]' ORDER BY cat_name LIMIT $num_sub");
         while ($row2 = sql_fetch_array ($res2))
         {
            $j++;
            $row2['cat_num'] = num_format ($row2['cat_num_links']);
            if ($config['enable_adp'] == 3) $row2['cat_id'] = create_seo_url ($row2['cat_id'], $row2['cat_name']);
            if ($j < $num_sub) $fs[] .= "<a href=\"list.php?cat_id=$row2[cat_id]\">$row2[cat_name]</a>";
         }
         $foo['subcat'] = implode (', ', $fs);
         if ($j > $num_sub - 1) $foo['subcat'] .= ', ...';
         if ($config['enable_adp'] == 3) $foo['cat_id'] = create_seo_url ($foo['cat_id'], $foo['cat_name']);
         $foo['subblock_cat_all'] .= quick_tpl ($tpl_subblock['cat_all'], $foo);

         if (!($i % $r))
         {
            $txt['block_cat_all'] .= quick_tpl ($tpl_block['cat_all'], $foo);
            $foo['subblock_cat_all'] = '';
         }
      }

      if (!empty ($foo['subblock_cat_all'])) $txt['block_cat_all'] .= quick_tpl ($tpl_block['cat_all'], $foo);
   
      // save to cache
      qcache_update ('dir_'.$set, $txt['block_cat_all']);
   }
}


// 7. ouput
$outline_tpl_mode = 'welcome';
$txt['main_body'] = quick_tpl ($tpl, $txt);
flush_tpl ();

   include("footer.php");

?>
 
jestrella
PostPosted: Thu Jun 17, 2010 3:26 pm Reply with quote

I guess something is missing, I don't see where the db_prefix variable is declared
 
transit
PostPosted: Thu Jun 17, 2010 8:39 pm Reply with quote

All ive done is add the include mainfile/header/footer lines at the top and bottom.

All the rest of the code works fine as for the actual portal I am trying to insert into my theme.

I even tried this; copying the Kemana Directory root to a folder called, 'Directory' within the nuke root. then changed the code to this (notice the '../') Cause it doesnt have to be a module I just need the theme wrapped around this portal. But I am still getting a white screen of death...

Code:


<?php

require_once('../mainfile.php');

   include("../header.php");

function check_backlink ()
{
   global $db_prefix;
   
   // get which dir_set requires backlink
   $f = sql_qquery ("SELECT dir_id FROM ".$db_prefix."dir_set WHERE set_backlink='1' ORDER BY RAND() LIMIT 1");
   $ds = $f[0];

   // get a url
   $row = sql_qquery ("SELECT item_id, backlink FROM ".$db_prefix."link WHERE dir_id='$ds' AND backlink_status = '0' LIMIT 1");
   if (!empty ($row))
   {
      // is it available?
      if (!empty ($row['backlink']))
      {
         $tmp = remote_fopen ($row['backlink']);
         if (empty ($tmp))
         {
            sql_query ("UPDATE ".$db_prefix."link SET backlink_status = '-1' WHERE item_id=$row[item_id] LIMIT 1");
         }
         else
         {
            if (!strpos ($tmp, html_unentities ($config['backlink_txt'])))
               sql_query ("UPDATE ".$db_prefix."link SET backlink_status = '-1' WHERE item_id=$row[item_id] LIMIT 1");
            else
               sql_query ("UPDATE ".$db_prefix."link SET backlink_status = '1' WHERE item_id=$row[item_id] LIMIT 1");
         }
      }
      else
         sql_query ("UPDATE ".$db_prefix."link SET backlink_status = '-1' WHERE item_id=$row[item_id] LIMIT 1");
   }
   else
   {
      // if no more backlink to check, reset everything back to 'unchecked'
      sql_query ("UPDATE ".$db_prefix."link SET backlink_status='0' WHERE dir_id='$ds'");
   }
}


function check_url ()
{
   global $db_prefix;

   // get which dir_set requires backlink
   $f = sql_qquery ("SELECT dir_id FROM ".$db_prefix."dir_set WHERE set_url='1' ORDER BY RAND() LIMIT 1");
   $ds = $f[0];

   // get a url
   $row = sql_qquery ("SELECT item_id, url FROM ".$db_prefix."link WHERE dir_id='$ds' AND url_status = '0' LIMIT 1");
   if (!empty ($row))
   {
      // is it available?
      if (!empty ($row['url']))
      {
         $tmp = @remote_fopen ($row['url']);
         if (empty ($tmp))
            sql_query ("UPDATE ".$db_prefix."link SET url_status = '-1' WHERE item_id=$row[item_id] LIMIT 1");
         else
            sql_query ("UPDATE ".$db_prefix."link SET url_status = '1' WHERE item_id=$row[item_id] LIMIT 1");
      }
   }
   else
   {
      // if no more backlink to check, reset everything back to 'unchecked'
      sql_query ("UPDATE ".$db_prefix."link SET url_status='0' WHERE dir_id='$ds'");
   }
}


/************************************************
 * Powered with qEngine v3 (c) C97.net
 * All rights reserved
 ************************************************/
 
// check install/
if (file_exists ('./install/'))
{
   die ('If you have just installed Kemana, please delete the <b>"install/"</b> folder on your server before using Kemana v1.4 (build 2010.04.20). Or <a href="install/index.php">'
       .'click here</a> to install Kemana for the first time.');
}

// very important file
require "./includes/user_init.php";

// close site?
if ($config['close_site']) msg_die ('site_closed');

// overwrite view mode?
$view_mode = get_param ('view_mode');
if (!empty ($view_mode))
{
   if ($view_mode == 'desktop') setcookie ($db_prefix.'view_mode', 'desktop', 0, "/");
   if ($view_mode == 'mobile') setcookie ($db_prefix.'view_mode', 'mobile', 0, "/");
   redir ();
}

// referral mode?
$ref = get_param ('ref');
if (!empty ($ref))
{
   $ip = $_SERVER['REMOTE_ADDR'];
   $row = sql_fetch_array (sql_query ("SELECT * FROM ".$db_prefix."ip_referred WHERE ref_ip = '$ip' LIMIT 1"));
   if (empty ($row['ref_ip']))
   {
       sql_query ("INSERT INTO ".$db_prefix."ip_referred VALUES ('$ip', 'refer', UNIX_TIMESTAMP())");
       sql_query ("UPDATE ".$db_prefix."user SET user_reff=user_reff+1 WHERE user_id='$ref' LIMIT 1");
   }
   redir ($config['site_url']);
}

// verify backlink? only 1 out of 10 visitors && backlink_code defined && allow http fopen
if ($config['backlink_txt'] && (mt_rand (1, 10) == 5)) check_backlink ();
if ($config['check_url'] && (mt_rand (1, 10) == 5)) check_url ();

// autoexec the following lines once each day
if ($config['last_autoexec'] != $sql_today)
{
   // send emails to soon to be expired
   $etpl = load_tpl ('mail', 'mail_expire.tpl');
   
   // only sent to: premium or sponsored, which will be expired in 7 days, has not been sent the email, and not edited (waiting for approval) links
   $last7 = convert_date ($sql_today, 'sql', 7);
   $res = sql_query ("SELECT item_id, title, short_note, t1.user_id, email, list_premium, list_sponsored, end_sponsored
   FROM ".$db_prefix."link AS t1 JOIN ".$db_prefix."user AS t2 USING (user_id)
   WHERE (list_premium = '1' OR list_sponsored='1') AND end_sponsored <= '$last7' AND exp_mailed != '1' AND old_id='0'");

   while ($row = sql_fetch_array ($res))
   {
      $row['site_url'] = $config['site_url'];
      $row['site_name'] = $config['site_name'];
      $row['end_sponsored'] = convert_date ($row['end_sponsored'], 'long');
      $body = quick_tpl ($etpl, $row);
      email ($email, $lang['l_exp_subject'], $body, 1, 1);   // send the email (logged)
      sql_query ("UPDATE ".$db_prefix."link SET exp_mailed='1' WHERE item_id='$row[item_id]' LIMIT 1"); // mark as sent
   }

   // update expired sponsore/preimum
   sql_query ("UPDATE ".$db_prefix."link SET list_regular='1', list_premium='0', list_sponsored='0' WHERE end_sponsored < '$sql_today'");
   
   // demo mode?
   if ($config['demo_mode']) { require './includes/admin_func.php'; require './reset/reset.php'; }
   
   // update autoexec
   sql_query ("UPDATE ".$db_prefix."config SET config_value='$sql_today' WHERE config_id='last_autoexec' LIMIT 1");
}

// welcome content
$outline_tpl_mode = 'welcome';
$tpl = load_tpl ('welcome.tpl');
load_tpl ('outline.tpl');

// 1. create portal pages (cached for better perfomance)
// replaced with PORTAL MODULE for maximum flexibility

// 2. create featured links
$txt['block_featured'] = ''; $i = 0; $r = $config['featured_col'];
$foo = array ('subblock_featured' => '');

// 2.1 fix featured links for single dir_set
if (!$multiple_set && empty ($config['featured_item']))
{
   $f = sql_qquery ("SELECT featured FROM ".$db_prefix."dir_set LIMIT 1");
   $config['featured_item'] = $f[0];
}

if ($config['featured_item'])
{
   $f = explode (';', $config['featured_item']);
    foreach ($f as $val)
   {
      $i++;

      $foo['featured_box'] = make_promo ($val, 'featured');
      $foo['subblock_featured'] .= quick_tpl ($tpl_subblock['featured'], $foo);

      if (!($i % $r))
      {
         $txt['block_featured'] .= quick_tpl ($tpl_block['featured'], $foo);
         $foo['subblock_featured'] = '';
      }
   }
}
if (!empty ($foo['subblock_featured'])) $txt['block_featured'] .= quick_tpl ($tpl_block['featured'], $foo);


// 3. get new link
$txt['block_new'] = ''; $i = 0; $r = $config['new_col'];
$foo = array ('subblock_new' => '');

$res = sql_query ("SELECT item_id FROM ".$db_prefix."link WHERE status='O' ORDER BY item_id DESC LIMIT $config[new_link]");
while ($row = sql_fetch_array ($res))
{
    $i++;

   $foo['new_box'] = make_promo ($row['item_id'], 'new');
   $foo['subblock_new'] .= quick_tpl ($tpl_subblock['new'], $foo);

   if (!($i % $r))
   {
      $txt['block_new'] .= quick_tpl ($tpl_block['new'], $foo);
      $foo['subblock_new'] = '';
   }
}
if (!empty ($foo['subblock_new'])) $txt['block_new'] .= quick_tpl ($tpl_block['new'], $foo);


// 4. get popular links
$txt['block_popular'] = ''; $i = 0; $r = $config['pop_col'];
$foo = array ('subblock_popular' => '');

$res = sql_query ("SELECT item_id FROM ".$db_prefix."link WHERE status='O' ORDER BY stat_hits DESC LIMIT $config[pop_link]");
while ($row = sql_fetch_array ($res))
{
    $i++;

   $foo['popular_box'] = make_promo ($row['item_id'], 'popular');
   $foo['subblock_popular'] .= quick_tpl ($tpl_subblock['popular'], $foo);

   if (!($i % $r))
   {
      $txt['block_popular'] .= quick_tpl ($tpl_block['popular'], $foo);
      $foo['subblock_popular'] = '';
   }
}
if (!empty ($foo['subblock_popular'])) $txt['block_popular'] .= quick_tpl ($tpl_block['popular'], $foo);


// 5. create featured content
$txt['block_feat_content'] = '';
$res = sql_query ("SELECT * FROM ".$db_prefix."featured ORDER BY idx");
while ($row = sql_fetch_array ($res))
{
   if (!empty ($row['feat_img']))
      $row['content'] = "<a href=\"$row[feat_url]\"><img src=\"public/image/$row[feat_img]\" alt=\"$row[feat_title]\" /></a>";
   else
      $row['content'] = $row['feat_text'];
   $txt['block_feat_content'] .= quick_tpl ($tpl_block['feat_content'], $row);
}


// 6. get old tree method (cached, and only for SINGLE DIR)
if (!$multiple_set)
{
   $s = sql_qquery ("SELECT dir_id FROM ".$db_prefix."dir_set LIMIT 1");
   $set = $s[0]; $num_sub = $config['cat_all_sub'] + 1;

   $txt['block_cat_all'] = qcache_get ('dir_'.$set);
   if (!$txt['block_cat_all'])
   {
      $i = 0; $r = $config['cat_all_col'];
      $foo = array ('subblock_cat_all' => '');

      $res = sql_query ("SELECT cat_id, cat_name, cat_num_links FROM ".$db_prefix."category WHERE dir_id='$set' AND parent='0' ORDER BY cat_name");
      while ($row = sql_fetch_array ($res))
      {
         $i++;
         $foo['cat_name'] = $row['cat_name'];
         $foo['cat_id'] = $row['cat_id'];
         $foo['cat_num'] = num_format ($row['cat_num_links']);
         $foo['subcat'] = '';
   
         // --- get subcat
         $j = 0; $fs = array ();
         $res2 = sql_query ("SELECT cat_id, cat_name, cat_num_links FROM ".$db_prefix."category WHERE parent='$row[cat_id]' ORDER BY cat_name LIMIT $num_sub");
         while ($row2 = sql_fetch_array ($res2))
         {
            $j++;
            $row2['cat_num'] = num_format ($row2['cat_num_links']);
            if ($config['enable_adp'] == 3) $row2['cat_id'] = create_seo_url ($row2['cat_id'], $row2['cat_name']);
            if ($j < $num_sub) $fs[] .= "<a href=\"list.php?cat_id=$row2[cat_id]\">$row2[cat_name]</a>";
         }
         $foo['subcat'] = implode (', ', $fs);
         if ($j > $num_sub - 1) $foo['subcat'] .= ', ...';
         if ($config['enable_adp'] == 3) $foo['cat_id'] = create_seo_url ($foo['cat_id'], $foo['cat_name']);
         $foo['subblock_cat_all'] .= quick_tpl ($tpl_subblock['cat_all'], $foo);

         if (!($i % $r))
         {
            $txt['block_cat_all'] .= quick_tpl ($tpl_block['cat_all'], $foo);
            $foo['subblock_cat_all'] = '';
         }
      }

      if (!empty ($foo['subblock_cat_all'])) $txt['block_cat_all'] .= quick_tpl ($tpl_block['cat_all'], $foo);
   
      // save to cache
      qcache_update ('dir_'.$set, $txt['block_cat_all']);
   }
}


// 7. ouput
$outline_tpl_mode = 'welcome';
$txt['main_body'] = quick_tpl ($tpl, $txt);
flush_tpl ();

   include("../footer.php");

?>
 
gregexp
The Mouse Is Extension Of Arm


Joined: Feb 21, 2006
Posts: 1497
Location: In front of a screen....HELP! lol

PostPosted: Fri Jun 18, 2010 12:19 am Reply with quote

hi transit,

once you include the mainfile.php, your RN install creates a mysql connection. Anything using mysql_query, will then use that connection instead.

Things like: require "./includes/user_init.php";

will not work outright, as they will technically be within your modules directory, and not within the includes directory of the root of your site.

This app should be ported over to Ravennuke.

For a temporary fix, you could create a module that simply loads a frame(or iframe), which opens up your content within the ravennuke header, blocks and footer:


Code:



<?php

if ( !defined('MODULE_FILE') ) {
    die ('You can\'t access this file directly...');
}
require_once('mainfile.php');
$module_name = basename(dirname(__FILE__));
get_lang($module_name);

$pagetitle = '- '.$module_name;

// BEGIN: Added in v2.40.00 - Mantis Issue 0001043
$index = 0;
if (!defined('INDEX_FILE')) define('INDEX_FILE', true); // Set to FALSE to hide right blocks
if (defined('INDEX_FILE') AND INDEX_FILE===true) {
// auto set right blocks for pre patch 3.1 compatibility
   $index = 1;
}


include('header.php');



echo "html code for your frame";
include('footer.php');
?>



This is not the ideal solution right now, but I can't write a port in a matter of minutes, but I could attempt to port over your info into a module at a later date. Until then, this may help.

_________________
For those who stand shall NEVER fall and those who fall shall RISE once more!! 
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
transit
PostPosted: Fri Jun 18, 2010 10:34 am Reply with quote

Ive been thinking and maybe I guess the easiest thing is since its not just simple html code but a whole wack of interlinking files. I should edit the outline.tpl which is the theme for this directory and wrap the theme I am using for this site around it as I wont be changing it. Then simply edit the links on the header to link back to the nuke installation. Thoughts?
 
gregexp
PostPosted: Fri Jun 18, 2010 2:25 pm Reply with quote

That's a major undertaking.

Though the system looks to have a decent amountof code, it is infact not that complex.

It would take a few days, but anyone who is familiar with RN modules and the core system would be able to port this over in a few days.
 
transit
PostPosted: Wed Jun 23, 2010 9:41 pm Reply with quote

Fortunately my site isnt using left or right blocks so I was able to squeeze it right in Only registered users can see links on this board! Get registered or login!

What do you think?

If I do need something like this or maybe even this intergrated into RN are you doing this or who should I talk to?
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©