RevCMS Vote Add-on

Results 1 to 3 of 3
  1. #1
    ☮TAKU???? seanrom is offline
    MemberRank
    Nov 2009 Join Date
    1,004Posts

    RevCMS Vote Add-on

    Vote plugin for RevCMS

    Features:
    Automaticlly discover what url to be sent back to.
    Automaticlly finds you user details in config.php
    Forces the user to vote (no way out).
    Recridts the user automatlicy to votingapi.com
    (and returns to client when done voting)
    If votingapi.com is offline it acts normal

    Install:

    Step 1:

    Go to class.core.php (/app/class.core.php)

    Insert this function called CheckIfVoted

    Code:
            final public function CheckIfVoted($ip) {
    
                      global $_CONFIG;
    
                      $vote_username = $_CONFIG['thehabbos']['username'];
    
                      $current_url = substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
    
                      $hotelurl = $_CONFIG['hotel']['url'];
    
                      $url = 'http://votingapi.com/validate.php?user=' . $vote_username . '&ip=' . $ip;
    
                      $context = stream_context_create(array('http' => array('timeout' => 5)));
    
                      $data =  @file_get_contents($url, 0, $context);
    
                      if(!$data || !is_numeric($data)) {
    
                        return "[ERROR] System Failure in voting system.";
    
                      } else if ($data == 1 || $data == 2) {
    
                          return "";
    
                      } else {
    
                          return '<form action="http://votingapi.com/vote/' . $vote_username . '" method="post"  name="votingform">
    
                          <input type="hidden" name="api_url" value="' . $hotelurl . '/' . $current_url . '" />
    
                          </form>
    
                          <script language="javascript">setTimeout("document.forms[\'votingform\'].submit()",0); </script>';
    
                        exit;
    
                    }
    
        }
    (You need to change your config.php details to make it work)

    Step 2:

    Go to class.template.php (/app/class.template.php)

    Code:
    Find: $this->setParams('server_ip', $_CONFIG['hotel']['server_ip']);
    
    UNDER Add this code: $this->setParams('votecheck', $core->CheckIfVoted($_SERVER['REMOTE_ADDR']));
    Step 3:

    You can now add {votecheck} to what page you want the user to vote before he/she watches the content

    Download:
    If you dont want to add the codes manually you can download it here: vote add-on.zip

    (Direct link: vote add-on.zip add-on.zip)

    Live Demo: Habztar: Best hotel around!

    Cheers

    -Ole


    YOU CAN FIND RevCMS HERE: [1.X] RevCMS [PHP, MYSQL] | DevBest.com - MMORPG Private Server Development


  2. #2
    "(still lacks brains)" NoBrain is offline
    MemberRank
    Sep 2011 Join Date
    United KingdomLocation
    2,658Posts

    Re: RevCMS Vote Add-on

    I don't like RevCMS...

    Nice work though!

  3. #3
    ☮TAKU???? seanrom is offline
    MemberRank
    Nov 2009 Join Date
    1,004Posts

    Re: RevCMS Vote Add-on

    Quote Originally Posted by Jupos View Post
    I don't like RevCMS...

    Nice work though!
    Thanks man



Advertisement