Results 1 to 11 of 11

Thread: Improved Link Validation Mod

  1. #1
    mpdaddy is offline Active Member
    Join Date
    Nov 2007
    Posts
    227

    Default Improved Link Validation Mod

    I have a new mod that I would like to enter into the Mod of the Month Contest. It totally changes the way IndexU validates links. In reality, it makes it easier and quicker to validate a large number of links.

    I have set this mod up at my demo website. I have added 16 links to the demo, feel free to test it out for yourself. The demo is reset every hour and is limited to functions related to my mods. The links are:

    User Area: http://www.scriptdragon.com/demo/

    Admin Area http://www.scriptdragon.com/demo/admin/

    Admin area login:
    U:admin
    P:admin

    Details

    Right now when you validate links, you need to:

    • Click the checkbox next to each item you want to "Approve".
    • Click on the "Approve" button.
    • Click the checkbox next to each item you want to "Reject with Notice".
    • Click on the "Reject with Notice" button.
    • Click the checkbox next to each item you want to "Reject Silently".
    • Click on the "Reject Silently" button.

    If you had 40 links to validate, you would need to validate 3 pages of links. If they were all approved, you would have to submit the page 3 times to validate them all. If you wanted to approve some, reject some with notice, and reject silently a few others, you could maybe have to submit the form 10 or more times. This is not efficient.

    With this mod, when you validate links, you need to:

    • Click the radio box to either "Approve", "Reject with Notice", or "Reject Silently" each link.
    • Click on the "Submit" button.

    If you had 40 links to validate, you could show all 40 on one page and validate them all in 1-click. Now, that is efficient.

    Now for the fun part, installing the mod.... Here we go.

    Step 1 - Make a backup of the following files:

    • IndexU\indexu_5_4_0\upload\admin\link_validate.php
    • IndexU\indexu_5_4_0\upload\admin_tpl\link_validate .html
    • IndexU\indexu_5_4_0\upload\admin_tpl\link_validate _rows.html
    • IndexU\indexu_5_4_0\upload\lib\link.class.php

    Note: Please do not skip making a backup of your files. If you need to uninstall the mod or have a conflict with another mod, these backup files will be needed.



    Step 2 - IndexU\indexu_5_4_0\upload\admin\link_validate.php :

    This file had major changes to it, therefore editing may not be appropriate for you. For this reason, I have added this file as an attachment to this thread. This file should replace your exising link_validate.php file. Please Note: If you have made any prior modifications to your link_validate.php, you should add those modifications to this file. If you have downloaded this file, you can skip this step. If not, here is what you need to do.

    Open up the file admin\link_validate.php and select everything (ctrl+a), now hit the delete key. Once you have a blank file to work with, insert this code into the file:

    Code:
    <?php
    
    /**
     *
     * INDEXU
     * Copyright(C), Nicecoder, 2000-2006, All Rights Reserved.
     *
     * INDEXU(tm) is protected by Indonesia and International copyright laws.
     * Unauthorized use or distribution of INDEXU(tm) is strictly prohibited,
     * violators will be prosecuted. To obtain a license for using INDEXU(tm),
     * please register at Nicecoder home page at http://www.nicecoder.com
     *
     * Author:
     *    Dody Rachmat Wicaksono (dody@nicecoder.com)
     *    M. Zuber (zubby@nicecoder.com)
     *
     */
    
      /*===================================================
        ViewLink()
      ===================================================*/
    
      function ViewLink() {
    
        // vars global configuration
        global $dbConn, $category_separator, $admin_template_path;
    
        // vars url & form
        global $cat, $pg_which, $spam;
    
        // vars messages
        global $msg;
    
        // vars template
        global $link, $pagination, $chk_box, $num_rows, $param, $vid, $nvl_results, $adds, $adds_link, $approved, $denied, $denied_silent;
    
        $results_number = 15;
        if ((!$nvl_results) || ($nvl_results == "1")) {
    	    $nvl_results = 1;
    	    $number_results = $nvl_results * $results_number;
        }
        else {
    	    $number_results = $nvl_results * $results_number;
        }
    
        $num_results = $number_results;
    
        $links_obj = new clsLink;
    
        if (!$spam) {
          $links_obj->query = "select * from idx_link_temp where spam = '0' order by date desc, vid desc";
        }
        else {
          $links_obj->query = "select * from idx_link_temp where spam = '1' order by date desc, vid desc";
        }
        $links_obj->table_name = "idx_link_temp";        // temp table
        $links_obj->category_table_name = "idx_category";
        $links_obj->template_file = $admin_template_path . "link_validate_rows.html";
        $links_obj->date_format = $msg["20081"];
        $links_obj->custom_field_offset++;
        $links_obj->custom_field_offset++;
    
        $links_obj->paging = true;
        $links_obj->pg_size = $num_results;
        $links_obj->href = "link_validate.php?nvl_results=$nvl_results";
        $links_obj->more_param = "";
        $links_obj->category_file = "../browse.php";
        $links_obj->category_separator = $category_separator;
    
        $links_obj->new_link_number=1;
        $link = $links_obj->Display(true);
        $pagination = $links_obj->pagination;
        $num_rows = $links_obj->new_link_number-1;
        $param = "pg_which=$pg_which&amp;nvl_results=$nvl_results";
    
        DisplayTemplate($admin_template_path . "link_validate.html",
          "\$num_rows,\$pagination,\$link,\$param,\$vid,\$spam,\$nvl_results,\$adds,\$adds_link,\$approved,\$denied,\$denied_silent");
      }
    
      /*===================================================
        ValidateLinks()
      ===================================================*/
    
      function ValidateLinks() {
    
        // vars global configuration
        global $dbConn, $admin_template_path, $email_address, $theme_path, $active_theme;
    
        // vars url & form
        global $num_rows, $spam;
    
        // vars messages
        global $msg;
    
        // vars template
        global $message, $back, $link_id, $title, $url, $description, $contact_name, 
                 $email, $bid, $category, $category_id, $approved_count, $denied_count, $denied_silent_count;
    
        $tpl = new Template();
    
        $theme_path = $theme_path . $active_theme;
    
        $links_obj = new clsLink;
        $links_obj->table_name = "idx_link";
        $links_obj->category_table_name = "idx_category";
        $links_obj->editor_table_name = "idx_editor";
        $links_obj->user_table_name = "idx_users";
    
        $addslink = $_REQUEST['addslink'];
        $approved_count = 0;
        $rejected_count = 0;
        $rejected_silently_count = 0;
    
        if(!empty($addslink)) {
    
    	  foreach($addslink as $k=>$v) {
    		  $id = $k;
    
    	if ($v == 1) {
    
        $category_obj = new clsCategory;
        $category_obj->table_name = "idx_category";
        $category_obj->user_table_name = "idx_users";
    
            $query = "select vid, link_id, title from idx_link_temp where vid = '$id'";
            $result = $dbConn->Execute($query);
            $lid = $result->Fields("link_id");
            $title = $result->Fields("title");
            $vid = $result->Fields("vid");
    
            if(empty($lid)) $flag = 0;
            else $flag = 1;
    
            if(!empty($vid)) {
            $links_obj->ApproveLink($id,$flag);
    
            // update new flag
            if($flag==0) $links_obj->UpdateNewFlag();
    
            // update updated flag
            elseif($flag==1) $links_obj->UpdateUpdatedFlag();
    
            // send email submitter
            $body = EvalTemplate($theme_path . "/mail/approved.mail", $links_obj->email_template_fields);
            $from = $email_address;
            mail($email, $msg["20131"], $body, "From: $from \nX-Mailer: INDEXU_X-Mailer/1.0");
    
            // send email to all editors
            $emails = $links_obj->GetEditorEmail($category_id);
            $j = 0;
            $count_emails = @count($emails);
            while ($j < $count_emails) {
              $body = EvalTemplate($theme_path . "/mail/approved_editor.mail", $links_obj->email_template_fields);
              $from = $email_address;
              mail($emails[$j], $msg["20133"], $body, "From: $from \nX-Mailer: INDEXU_X-Mailer/1.0");
              $j++;
            }
    
            // send email to all subscriber
            $subscribe_emails = $category_obj->GetSubscriberEmail($category_id);
            $j = 0;
            $count_subscribe_emails = @count($subscribe_emails);
            while ($j < $count_subscribe_emails) {
              $body = EvalTemplate($theme_path . "/mail/approved_subscriber.mail", $links_obj->email_template_fields);
              $from = $email_address;
              mail($subscribe_emails[$j], $msg["20133"], $body, "From: $from \nX-Mailer: INDEXU_X-Mailer/1.0");
              $j++;
            }
        }
            $approved_count++;
    }
    	if ($v == 2) {
    
            $query = "select vid, title from idx_link_temp where vid = '$id'";
            $result = $dbConn->Execute($query);
            $title = $result->Fields("title");
            $vid = $result->Fields("vid");
    
            if(!empty($vid)) {
            $links_obj->RejectLink($id);
    
            // send email submitter
              $body = EvalTemplate($theme_path . "/mail/rejected.mail",$links_obj->email_template_fields);
              $from = $email_address;
              mail($email,$msg["20135"],$body,
                 "From: $from \nX-Mailer: INDEXU_X-Mailer/1.0");
    
            // send email to all editors
            $emails = $links_obj->GetEditorEmail($category_id);
            $j = 0;
            $count_emails = @count($emails);
            while ($j < $count_emails) {
              $body = EvalTemplate($theme_path . "/mail/rejected_editor.mail",$links_obj->email_template_fields);
              $from = $email_address;
              mail($emails[$j],$msg["20137"],$body,
                "From: $from \nX-Mailer: INDEXU_X-Mailer/1.0");
              $j++;
            }
        }
            $rejected_count++;
    }
    	if ($v == 3) {
    
            $query = "select vid, title from idx_link_temp where vid = '$id'";
            $result = $dbConn->Execute($query);
            $title = $result->Fields("title");
            $vid = $result->Fields("vid");
    
            if(!empty($vid)) {
            $links_obj->RejectLink($id);
    
            // send email to all editors
            $emails = $links_obj->GetEditorEmail($category_id);
            $j = 0;
            $count_emails = @count($emails);
            while ($j < $count_emails) {
              $body = EvalTemplate($theme_path . "/mail/rejected_editor.mail",$links_obj->email_template_fields);
              $from = $email_address;
              mail($emails[$j],$msg["20137"],$body,
                "From: $from \nX-Mailer: INDEXU_X-Mailer/1.0");
              $j++;
            }
        }
            $rejected_silently_count++;
        }
    }
        if ($approved_count >= 1) {
    	    $message = $approved_count ." Links Accepted <br />" .$rejected_count. " Links Rejected <br />" .$rejected_silently_count. " Links Rejected Silently <br />";
    	    $message .= $msg['30015'];
        }
        else {
    	    $message = $approved_count ." Links Accepted <br />" .$rejected_count. " Links Rejected <br />" .$rejected_silently_count. " Links Rejected Silently <br />";
        }
    
        $back = "<a href=link_validate.php?spam=$spam>Back</a>";
    
        DisplayTemplate($admin_template_path . "message.html", "\$message,\$back,\$approved_count,\$rejected_count,\$rejected_silently_count");
    }
    
        else {
    	    $message = $msg["20122"];
    
        $back = "<a href=link_validate.php?spam=$spam>Back</a>";
    
        DisplayTemplate($admin_template_path . "message.html", "\$message,\$back,\$approved_count,\$rejected_count,\$rejected_silently_count");
        }
    }
      /*===================================================
        main
      ===================================================*/
    
      include "../application.php";
      
      RunPreFilter(__FILE__);
    
      DisplayTemplate($admin_template_path . "header.html");
    
      if (empty($pflag)) {
        ViewLink();
      }
      elseif ($pflag == 'submit') {
        ValidateLinks();
      }
    
      DisplayTemplate($admin_template_path . "footer.html");
    
      RunPostFilter(__FILE__);
    
    ?>
    Now save this file, we are done with it.



    Step 3 - Editing IndexU\indexu_5_4_0\upload\admin_tpl\link_validate .html:

    Find this code:
    Code:
           <%if $link%>
          <tr>
            <td class="tbl_light2" colspan="2">
              <input type="button" name="select_all_1" value="Select All" class="button" onclick="ToggleSelect(this)">
            </td>
          </tr>
          <%$link%>
    And replace it with this code:
    Code:
          <%if $link%>
          <tr>
            <td class="tbl_light2" colspan="2" align="center">
              <b>Show 
              <select name="nvl_results" onChange="this.form.submit()"><option value="1"<%if $nvl_results == 1%> selected<%/if%>>15</option>
              <option value="2"<%if $nvl_results == 2%> selected<%/if%>>30</option>
              <option value="3"<%if $nvl_results == 3%> selected<%/if%>>45</option>
              <option value="4"<%if $nvl_results == 4%> selected<%/if%>>60</option>
              <option value="5"<%if $nvl_results == 5%> selected<%/if%>>75</option>
              </select>&nbsp;Results Per Page</b>
            </td>
          </tr>
          <%$link%>

    Now, find this code:
    Code:
            <td class="tbl_light2" colspan="2" align="center">
              <div align="left">
              <input type="button" name="select_all_2" value="Select All" class="button" onclick="ToggleSelect(this)">
              </div>
              <input type="button" value="Approve" class="button" onclick="if(confirm('Are you sure want to approve these links?')) SetProcessFlag(this, 'approve')">
              <input type="button" value="Reject with Notice" class="button" onclick="if(confirm('Are you sure want to reject these links?')) SetProcessFlag(this, 'reject')">
              <input type="button" value="Reject Silently" class="button" onclick="if(confirm('Are you sure want to reject these links?')) SetProcessFlag(this, 'rejectsilent')">
              <input type="reset" value="Reset" class="button">
            </td>
    And replace it with this code:
    Code:
            <td class="tbl_light2" colspan="2" align="center">
              <input type="submit" value="Submit" class="button" onclick="SetProcessFlag(this, 'submit')">
              <input type="reset" value="Reset" class="button">
            </td>
    What we did above:
    • We removed the "Select All" buttons from both the top and bottom of the page.
    • We added a dropdown to select the number of results to display on the page.
    • We removed the "Approve", "Reject with Notice", and "Reject Silently" buttons from the bottom of the page.
    • We replaced those buttons with a "Submit" button.

    You are done with this file, save it.




    Step 4 - Editing IndexU\indexu_5_4_0\upload\admin_tpl\link_validate _rows.html:

    Find the code like this:
    Code:
                  <%$chk_box%>&nbsp; <a href="link_validate_edit.php?id=<%$vid%>" title="Edit" alt="Edit"><img src="../admin_tpl/images/pen.gif" border="0"></a>
    Replace it with this:
    Code:
                  <a href="link_validate_edit.php?id=<%$vid%>" title="Edit" alt="Edit"><img src="../admin_tpl/images/pen.gif" border="0"></a>

    Then find this code:
    Code:
                  <b>Contact</b>: <%$contact_name%><br>
                  <b>Email</b>: <%$email%><br>
                  </font>
    Directly below it, insert this:
    Code:
                  <b><%$adds%></b>
    This section should now look like this:
    Code:
                  <b>Contact</b>: <%$contact_name%><br>
                  <b>Email</b>: <%$email%><br>
                  </font>
                  <b><%$adds%></b>
    What we did above:
    • We removed the checkbox next to each link.
    • We added radio buttons below each link listing.

    You are done with this file, save it.



    Step 5 - Editing IndexU\indexu_5_4_0\upload\lib\link.class.php:

    Find the code like this: Hint: It's near line 1027
    Code:
            $chk_box = "<input type=checkbox name=chkbox_$number value=$link_id>";
    
            if ($validation)
              $chk_box = "<input type=checkbox name=chkbox_$number value=$vid>";
    
            $tpl->assign('chk_box', $chk_box);
    Replace it with this code:
    Code:
            $chk_box = "<input type=checkbox name=chkbox_$number value=$link_id>";
            $adds = "<input type=\"radio\" name=\"addslink[$link_id]\" value=\"1\" />Approve&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"radio\" name=\"addslink[$link_id]\" value=\"2\" />Reject with Notice&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"radio\" name=\"addslink[$link_id]\" value=\"3\" />Reject Silently&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    
            if ($validation)
              $chk_box = "<input type=checkbox name=chkbox_$number value=$vid>";
              $adds = "<input type=\"radio\" name=\"addslink[$vid]\" value=\"1\" />Approve&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"radio\" name=\"addslink[$vid]\" value=\"2\" />Reject with Notice&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=\"radio\" name=\"addslink[$vid]\" value=\"3\" />Reject Silently&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    
            $tpl->assign('chk_box', $chk_box);
            $tpl->assign('adds', $adds);

    What we did above:
    • We added the variable "$adds" which is called from the link_validate_rows.html file. It displays the radio buttons.
    • We assigned the variable "$adds" so the template file knows what to do when "<%$adds%>" is called.


    You are done with this file, save it.

    Step 6 - Uploading:
    Upload all the files you edited. If you downloaded the file (link_validate.php) attached to this thread, make sure you upload it too.


    You are done installing this mod. It should now look like my demo.

    I want to thank FSGDAG for the idea to create this mod. He gave me the idea and tested it on his website at http://www.Web4URL.com.

    This mod is also available for Free at my mod store at http://store.scriptdragon.com. I have many more mods, both paid and Free, available and installation is always free (I will also install my Free mods for Free).
    Attached Files Attached Files
    For questions related to any mods I developed, please contact me by pm or email at webmaster [at] scriptdragon [dot] com

  2. #2
    FSGDAG's Avatar
    FSGDAG is offline Moderator
    Join Date
    May 2007
    Location
    NJ, United States
    Posts
    1,651

    Default

    I've got to tell everyone that this MOD is saving me a TON of time and makes the validating link process in IndexU easier!!!

    mydaddy did a GREAT job on this!!!! He does a really good job on all of his MODs. I have a couple of his installed now and his MODs are a GREAT asset to the IndexU community!
    FSGDAG | IndexU Hosting | Owner
    Website | NiceCoder Script Hosting and More! | Web4URL is For Sale!
    Follow Us On Twitter | FaceBook Profile | YouTube Videos

  3. #3
    fxdir is offline Registered User
    Join Date
    Feb 2008
    Location
    Winnipeg Canada
    Posts
    23

    Default

    wow , really amazing mod !
    Installed , everything works perfect , I just modified a little - inserted also Reciprocal Url field for every link
    Thank you !

  4. #4
    esm's Avatar
    esm
    esm is offline Active Member
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    Quote Originally Posted by mpdaddy View Post
    I have a new mod that I would like to enter into the Mod of the Month Contest.
    Shucks...!!! and here I thought bruce was going to award my little IP MOD the winner of the $100 MOD-of-the-Month for this month (yeah, right. like that was really going to happen ).

    Dagnabit...*&#^#%&@! Foiled again....! Curses...!




    .
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  5. #5
    inspireme is offline Active Member
    Join Date
    Nov 2004
    Posts
    1,822

    Default

    nice
    Main IndexU sites : | Campsite Directory | Tourist Guide | Places2B | AfterDirectory <-- Half price submission using coupon DP50 (from just $11 premium, and $10 basic permanent )

  6. #6
    esm's Avatar
    esm
    esm is offline Active Member
    Join Date
    Apr 2003
    Location
    Atlanta GA
    Posts
    3,395

    Default

    Mod Of The Month Winner - March

    all of what I said was with tongue-in-cheek. Well, except for the part about yours being a really great MOD.

    Seriously, though, congratulations. Very nicely done.



    .
    esm
    "The older I get, the more I admire competence, just simple competence, in any field from adultery to zoology."

    .

  7. #7
    mpdaddy is offline Active Member
    Join Date
    Nov 2007
    Posts
    227

    Default

    Thank You
    For questions related to any mods I developed, please contact me by pm or email at webmaster [at] scriptdragon [dot] com

  8. #8
    FSGDAG's Avatar
    FSGDAG is offline Moderator
    Join Date
    May 2007
    Location
    NJ, United States
    Posts
    1,651

    Default

    WAHOOO!!!!! Congrats mpdaddy!!!!
    FSGDAG | IndexU Hosting | Owner
    Website | NiceCoder Script Hosting and More! | Web4URL is For Sale!
    Follow Us On Twitter | FaceBook Profile | YouTube Videos

  9. #9
    secero is offline Registered User
    Join Date
    Feb 2008
    Posts
    20

    Default

    works this also with version 6.0?

  10. #10
    mpdaddy is offline Active Member
    Join Date
    Nov 2007
    Posts
    227

    Default

    It does not work with 6.0 yet. I am waiting for an official release, then I will make all my mods compatible with the new version. Each time a new IndexU version is released, I will upgrade all my mods.

    Regards
    Wayne
    For questions related to any mods I developed, please contact me by pm or email at webmaster [at] scriptdragon [dot] com

  11. #11
    secero is offline Registered User
    Join Date
    Feb 2008
    Posts
    20

    Default

    ok, thank you.

Similar Threads

  1. Field validation
    By beto in forum v5.x
    Replies: 3
    Last Post: 12-24-2006, 09:48 AM
  2. User Validation Fix
    By mbarnett in forum v5.x
    Replies: 1
    Last Post: 08-20-2006, 08:55 PM
  3. Replies: 4
    Last Post: 03-05-2006, 06:26 AM
  4. improved serchlog
    By tjoerg in forum v3.2
    Replies: 3
    Last Post: 05-19-2003, 10:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •