Apr 26 2007

phpLD Image Uploader MOD

Tag: phpLD Modsadmin @ 4:18 am

With this modification you can allow users to upload a profile image that will be placed in their details page.

1. Create a folder called uploads in the same folder as submit.php (root of the directory)

2. chmod 777 uploads

3. create a file image_upload.php in the same folder as submit.php, with the content below:

<?php $error=$_FILES[”IMAGE”][”error”];

if ($error == UPLOAD_ERR_OK) {

 $parsed = parse_url($_POST[”URL”]);

 $image_domain = $parsed[’host’];

 $image_type=$_FILES[’IMAGE’][’type’];

 $image_loc=”uploads/”.$image_domain.”.jpg”;

 $tmp_name = $_FILES[”IMAGE”][”tmp_name”];

  if ($image_type ==”image/pjpeg” ||

      $image_type==”image/gif”    ||

      $image_type==”image/png”){

    move_uploaded_file($tmp_name, $image_loc);

  }

}

?>

4. in submit.php,

AFTER: require_once 'init.php';

ADD: require_once "image_upload.php";

5. in submit.tpl

FIND :

<form action="" method="post">

REPLACE BY:

<form action="" method="post"

          enctype="multipart/form-data">

FIND:

<td class="field">

      {* Load category selection *}

      {include file="category_select.tpl"}

   </td>

   </tr>

AFTER it, ADD:

<tr>

 <td class="label">Image</td>

 <td class="field">

  <input type="file" name="IMAGE" />

 </td></tr>

7. in detail.tpl, where you want the image to appear.

ADD:

{php}

$uploads_path="/path/to/uploads/";

$parsed = parse_url($this->_tpl_vars[URL]);

$image_domain = $parsed['host'];

$abs_image_loc = $uploads_path.$image_domain.".jpg";

$image_loc = "../uploads/".$image_domain.".jpg";

if (file_exists($abs_image_loc)) {

  echo "<img src=\"" . $image_loc . "\" />";

}

{/php}

EDIT : $uploads_path=”/path/to/uploads/”;

in the code above to something to the absolute path

to your uploads folder something like

“/home/domain/public_html/uploads/”

That’s it.

The mod can be improved by adding small test on the image size and dimensions.


Apr 24 2007

Phpld deeplinks mod

Tag: phpLD Modsadmin @ 1:38 pm

This modification allows to offer deeplinks in your directory. It is a safe modification but you are better off backing up the database and the following files:

include/tables.php

/detail.php

submit.tpl

detail.tpl

You might as well test it in your test directory first. I tested it on version 3.2 and it works great.

First: we have to add additional fields in the PLD_LINK table:

1. Open include/tables.php

FIND:

'RECPR_EXPIRED' => 'L NOTNULL DEFAULT 0'

REPLACE BY:

'RECPR_EXPIRED' => 'L NOTNULL DEFAULT 0' ,

'TITLE1' => 'C(255) NULL' ,

'URL1' => 'C(255) NULL' ,

'TITLE2' => 'C(255) NULL' ,

'URL2' => 'C(255) NULL' ,

'TITLE3' => 'C(255) NULL' ,

'URL3' => 'C(255) NULL' ,

'TITLE4' => 'C(255) NULL' ,

'URL4' => 'C(255) NULL' ,

'TITLE5' => 'C(255) NULL' ,

'URL5' => 'C(255) NULL'

2. NOW rerun the install script by pointing to install/index.php, this will update the table structure.

Second: Modify the submit form:

in submit.tpl

FIND:

<tr>

   <td class="label">{l}Description{/l}:</td>

ABOVE it, ADD:

<tr>

    <td class="label">TITLE 1</td>

    <td class="field"><input type="text"

 name="TITLE1" value="{$TITLE1|escape|trim}"

 size="40" maxlength="255" class="text"/></td>

  </tr>

  <tr>    <td class=”label”>URL 1</td>

    <td class=”field”><input type=”text”

 name=”URL1″ value=”http://{$URL1|escape|trim}”

 size=”40″ maxlength=”255″ class=”text”/></td>

  </tr>

  <tr>

    <td class=”label”>TITLE 2</td>

<td class=”field”><input type=”text”

 name=”TITLE2″ value=”{$TITLE2|escape|trim}”

 size=”40″ maxlength=”255″ class=”text”/></td>

  </tr>

  <tr>

    <td class=”label”>URL 2</td>

    <td class=”field”><input type=”text”

 name=”URL2″ value=”http://{$URL2|escape|trim}”

 size=”40″ maxlength=”255″ class=”text”/></td>

</tr>

  <tr>

    <td class=”label”>TITLE 3</td>

    <td class=”field”><input type=”text”

 name=”TITLE3″ value=”{$TITLE3|escape|trim}”

 size=”40″ maxlength=”255″ class=”text”/></td>

  </tr>

<tr>

    <td class=”label”>URL 3</td>

    <td class=”field”><input type=”text”

 name=”URL3″ value=”http://{$URL3|escape|trim}”

 size=”40″ maxlength=”255″ class=”text”/></td>

  </tr>

  <tr>

<td class=”label”>TITLE 4</td>

    <td class=”field”><input type=”text”

 name=”TITLE4″ value=”{$TITLE4|escape|trim}”

 size=”40″ maxlength=”255″ class=”text”/></td>

  </tr>

  <tr>

    <td class=”label”>URL 4</td>

<td class=”field”><input type=”text”

 name=”URL4″ value=”http://{$URL4|escape|trim}”

 size=”40″ maxlength=”255″ class=”text”/></td>

  </tr>

  <tr>

    <td class=”label”>TITLE 5</td>

    <td class=”field”><input type=”text”

 name=”TITLE5″ value=”{$TITLE5|escape|trim}”

 size=”40″ maxlength=”255″ class=”text”/></td>

</tr>

    <tr>

    <td class=”label”>URL 5</td>

    <td class=”field”><input type=”text”

 name=”URL5″ value=”http://{$URL5|escape|trim}”

 size=”40″ maxlength=”255″ class=”text”/></td>

  </tr>

Finally Show the additional links in the details page.

To do so, we have to modify detail.php and detail.tpl

1. in detail.tpl

FIND:

<tr>

<td class="label">{l}Description{/l}:</td>

<td class="smallDesc" align="left">{$DESCRIPTION|escape|trim}</td>

</tr>

BELOW, ADD:

<tr>

<td class="label">{l}Products/Services:{/l}</td>

<td class="smallDesc" align="left">

<a href="{$URL1|escape|trim}">{$TITLE1|escape|trim}</a>&nbsp;

<a href=”{$URL2|escape|trim}”>

{$TITLE2|escape|trim}</a>&nbsp;

<a href=”{$URL3|escape|trim}”>

{$TITLE3|escape|trim}</a>&nbsp;

<a href=”{$URL4|escape|trim}”>

{$TITLE4|escape|trim}</a>&nbsp;

<a href=”{$URL5|escape|trim}”>

{$TITLE5|escape|trim}</a>&nbsp;

</td>

</tr>

2. in detail.php

FIND:

$data['META_DESCRIPTION'] = $rdata['META_DESCRIPTION'];

BELOW it, ADD:

$data['TITLE1']    = $rdata['TITLE1'];

$data['URL1']    = $rdata['URL1'];

$data['TITLE2']    = $rdata['TITLE2'];

$data['URL2']    = $rdata['URL2'];

$data['TITLE3']    = $rdata['TITLE3'];

$data['URL3']    = $rdata['URL3'];

$data['TITLE4']    = $rdata['TITLE4'];

$data['URL4']    = $rdata['URL4'];

$data['TITLE5']    = $rdata['TITLE5'];

$data['URL5']    = $rdata['URL5'];

You are done, now all plans (regular and featured will have the optional 5 additional links.

To modify the number of additional links the code above should be modified accordingly (straightforward).

To allow a lower number of additional links for regular listings a simple javascript code can be added to the radio buttons of payment to hide some of the fields when “regular” is selected. Otherwise you can juste allow the same number of links for all plans.

Another additional feature could be to check if the deeplinks come from the same domain. Use your imagination.

I think this modification can be used for all versions of phpld but I only tested it on 3.2. These steps can be done everytime you upgrade the script, so you might bookmark this page or copy its content.

Feel free to improve this mod.


Apr 03 2007

PhpLD Mods List Available

Tag: phpLD Modsadmin @ 9:46 pm

The phpLD script owner David Duval on his
‘Forum has compiled a nice list of mods. I created the mod list below to make it more available to everyone who runs phpLD script directory.

‘Accept Terms’ check box
‘Click here for Mod

Adding Pages- Adding new pages e.g. About Us, Terms & Conditions etc.
‘Click for Mod

Alternate Payment Mod
Adds two payment options in addition to the default PayPal option: StormPay and 2CheckOut
‘Click for Mod

Alternating row colors to link listings
‘Click for Mod

Alexa Thumbnails- Display site thumbnails next to each link
‘Click for Mod

Category Dropdown Edit- Remove |__ from category drop on submit page

a) ‘Click here for Mod
b) ‘Click here for Mod

Contact Page
Add a contact page to your dir
‘Click here for Mod

Change Backround Color on featured link
‘Click for Mod

Change Payment Currency-Payment from $(US) to £(GBP) or any other currency.
‘Click for Mod

Categories in footer-Show main categories practically in footer (obviously not on main page)

‘Click for Mod

Date Added/Modified- Show date added and/or modified for listings
‘Click for Mod

Description length check mod
Shows on submit page “Description requires between xx-xx characters.”
‘Click for Mod

Details Mod
Generates a dynamic details page for links
‘Click for Mod

Display URL Mod
URL displayed goes to a different link e.g affiliate link
‘Click for Mod

DMOZ Import mods - Imports DMOZ listings

a) ‘Click here for Mod
b) ‘Click here for Mod
c) ‘Click here for Mod

Email Author
Allows surfers to contact listing owner/author
‘Click for Mod

Email as HTML
Ability to use html in email templates. Thus you can send images in emails etc.
‘Click for Mod

Dynamic search engine linking
As seen in Open Directory
‘Click for Mod

Featured Listing
Add another featured link option to the submit page
‘Click for Mod

Featured Links in Top Listings
This mod will list Featured Links above other links in New Listings, Popular Listings, and Top Rated Listings.
‘Click for Mod

GZIP Compress
Speeds up your directory
‘Click for Mod

Framed Listing Mod
Opens links in framed environment.
‘Click for Mod

Google Ads inside link pages
Shows Google ads as “Sponsored Links”
‘Click for Mod

Google ads top_bar
Adds google link unit to top_bar section
‘Click for Mod

Fields
Add extra fields to the database
‘Click for Mod

Highlight Search Terms
Highlight search term on the search results page
‘Click for Mod

HTACCESS rewriter
Category/subcategory-specific RewriteRules
‘Click for Mod

Left Column
New left column left of directory
‘Click for Mod

phpLD PageRank Updater Application

‘Click for Mod

Paid PhpLinkDirectory Mods

Click for Mod

As soon as i found more mods i will post them here but you can check out the phpLD Forum to see what they have to offer.