⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modplugin.php

📁 太烦了
💻 PHP
📖 第 1 页 / 共 5 页
字号:
<?php/** * <b>modPlugin</b> <i>Extend your OsDate capabilities</i><br> * <br> *  modPlugin is an API alowing you to extend OsDate's capabilities without modifing OsDate itself.  Plugins can be written in packages that can be distributed, uploaded and installed from a single zip file.<br> *  <br> *  <br> *  <b>Plugin File Structure</b><br> *  <br> *  pluginTemplate - Plugin Directory.  Must be named the same as the plugin.<br> *  pluginTemplate/language - Language directory.  Containts language definitions.<br> *  pluginTemplate/language/lang_spanish<br> *  pluginTemplate/language/lang_spanish/lang_main.php - Spanish language definitions.<br> *  pluginTemplate/language/lang_german<br> *  pluginTemplate/language/lang_german/lang_main.php - German language definitions.<br> *  pluginTemplate/language/lang_english<br> *  pluginTemplate/language/lang_english/lang_main.php - English language definitions.<br> *  pluginTemplate/language/lang_portuguese<br> *  pluginTemplate/language/lang_portuguese/lang_main.php - Portuguese language definitions.<br> *  pluginTemplate/language/lang_greek<br> *  pluginTemplate/language/lang_greek/lang_main.php - Greek language definitions.<br> *  pluginTemplate/language/lang_turkish<br> *  pluginTemplate/language/lang_turkish/lang_main.php - Turkish language definitions.<br> *  pluginTemplate/language/lang_romanian<br> *  pluginTemplate/language/lang_romanian/lang_main.php - Romanian language definitions.<br> *  pluginTemplate/language/lang_russian<br> *  pluginTemplate/language/lang_russian/lang_main.php - Russian language definitions.<br> *  pluginTemplate/language/lang_dutch<br> *  pluginTemplate/language/lang_dutch/lang_main.php - Dutch language definitions.<br> *  pluginTemplate/language/lang_french<br> *  pluginTemplate/language/lang_french/lang_main.php - French language definitions.<br> *  pluginTemplate/images - Plugin specific images.<br> *  pluginTemplate/sql<br> *  pluginTemplate/sql/install.sql - Table creation SQL.<br> *  pluginTemplate/includes<br> *  pluginTemplate/includes/default_config.php - Default configuration values.<br> *  pluginTemplate/templates - Plugin templage directory.<br> *  pluginTemplate/templates/default<br> *  pluginTemplate/templates/default/helloworld.tpl - User template.<br> *  pluginTemplate/templates/default/admin<br> *  pluginTemplate/templates/default/admin/helloworld.tpl - Admin template<br> *  pluginTemplate/libs - Classes related to plugin.<br> *  pluginTemplate/libs/pluginTemplate.php - Main plugin class.  Must be named the same as the plugin.<br> *  <br> *  <br> *  <b>Displaying Content</b><br> *  <br> *  There are four methods to display content on the OsDate site, displayPluginPage, displayPluginContent, displayLeftCol and displayMain.  These methods return HTML to be displayed.  The modPlugin logic handles the actual display of the HTML.<br> *  <br> *  <br> *  <b>displayPluginPage</b><br> *  <br> *  displayPluginPage is used when you need a new page on the osdate site.  HTML returned by displayPluginPage is displayed in the main content area of OsDate.  When you set the $user_menu_text variable to the text to appear on the menu, and set user_menu_appear to true, a link to your page will appear on the user menu.  You can also access the page directly using the link plugin.php?plugin=pluginTemplate (assuming your plugin naem is pluginTemplate).<br> *  <br> *  <br> *  <b>displayPluginContent</b><br> *  <br> *  displayPluginContent is used when you need a new page with only your content.  For example if you need a popup window that displays a simple message.  The HTML returned by displayPluginContent is displayed on the new page.  You can also access the page directly using the link pluginraw.php?plugin=pluginTemplate (assuming your plugin naem is pluginTemplate).<br> *  <br> *  <br> *  <b>displayLeftCol</b><br> *  <br> *  displayLeftCol will display your content in the left column of OsDate.  The HTML returned by displayLeftCol is displayed.<br> *  <br> *  <br> *  <b>displayMain</b><br> *  <br> *  displayMain will display your content in the main content area of OsDate below the existing main content.  The HTML returned by displayMain is displayed.<br> *  <br> *  <br> *  <b>Getting Started</b><br> *  <br> *  To get started on your first plugin, make a directory inside the plugins directory the name of your new plugin (ex. mkdir plugins/myNewPlugin).  Then copy all the files in the plugins/pluginTemplate directory to your new directory (ex. cp -r plugins/pluginTemplate/. plugins/myNewPlugin/).  Now rename pluginTemplate.php to the name of your plugin (ex. mv pluginTemplate.php myNewPlugin.php.  Lastly, open myNewPlugin.php and rename all instances of pluginTemplate to myNewPlugin.<br> *  <br> *  Now that you have all the files you need, start writing your code using the methods and  documentation listed below.<br> *  <br> * * @author Down Home Consutling (www.DownHomeConsulting.com) * @version 1.0 * @package modOsDate */class modPlugin {   /**   * Holds an array of error messages   * @access private   */  var $_errorMessage = array();   /**   * Holds the language phrases for the active language in an associative array   *   * @access public   */   var $lang = array();   /**   * Holds the configuration settings   *   * @access private   */   var $config = array();   /**   * The link text that appears on the user's menu   *   * @access private   */   var $menu_text;   /**   * Appear on users menu (true or false)   *   * @access private   */   var $menu_appear = true;   /**   * Constructor, called by modOsDate to initialize plugin class.  There should never be a need to call this directly.   *   * @return void   * @access public   */  function modPlugin( )  {    // Read the configuration    $this->_initConfig();    // Read the configuration//    include($this->getLanguageDir() . 'lang_main.php');    // Save language array//    $this->lang = $lang;  } // end of member method pluginClass  /**   *  add an event to calendar X, event details specified in parameter   * @param array $param an associative array with the following keys:<br><ul>   *             <li>userid - user id</li>   *             <li>event</li>   *             <li>description  </li>   *             <li>recurring  - 1 or 0</li>   *             <li>recuroption -  (0 = none, 1 = days, 2 = weeks, 3 = months, 4 = years)</li>   *             <li>calendarid </li>   *             <li>enabled  - Y or N</li>   *             <li>timezone  </li>   *             <li>datetime_from  </li>   *             <li>datetime_to  </li>   *             <li>private_to</li></ul>   * @return  bool True on success.  False on failure.   * @access public   */  function modAddEvent( $param )  {      $defaults = array(         'recuroption' => '0',         'private_to' => '',      );      $param = array_merge($defaults,$param);      include_once(MODOSDATE_DIR . 'calendarevents_data.php');      $evnt = new calendarEventsData();      $evnt->addRec($param);      return $this->_setStatus($evnt);  }  /**   * return a list of permissions available to a particular user   *   * @param array $param an associative array with the following keys:<br><ul>   *        <li>userid - user id of the user to logout</li></ul>   * @return array   * @access public   */  function modAvailablePermissions($param )  {      $perm = array();      $user = $this->modGetUser($param['userid'] );      if ( $user['active'] ) {         $search['roleid'] = $user['level'];         $perm = $this->modGetMembershipPriviledges($search);         unset($perm['id']);         unset($perm['roleid']);         unset($perm['name']);         unset($perm['activedays']);         unset($perm['fullsignup']);         unset($perm['price']);         unset($perm['currency']);         unset($perm['enabled']);      }      return $perm;  }  /**   * returns the registration status of a particular user   *   * @param array $param an associative array with the following keys:<br><ul>   *         <li>userid - user id of the user</li></ul>   * @return string   * @access public   */  function modCheckStatus($param )  {      $user = $this->modGetUser($param['userid'] );      return $user['status'];  }  /**   * clear a ban of user X for user Y   *   * @param array $param an associative array with the following keys:<br><ul>   *           <li>userid - user id of the user to remove ban</li>   *           <li>type - type of ban to remove, B for ban, H for hotlist, F for buddy</li></ul>   * @return  bool True on success.  False on failure.   * @access public   */  function modClrBan($param )  // Additional  {         $result = true;         $user = $this->modGetUser( array('userid' => $param['userid']) );         if ( ! isset($user['username']) ) {            $this->_setErrorMessage("Userid doesn't exist");            $result = false;         }         else {            include_once(MODOSDATE_DIR . 'buddy_ban_list_data.php');            $bud = new buddyBanListData();            // See if already banned            //            $search['act']          = $param['type'];            $search['username']     = $user['username'];            //$search['            $bud->deleteRec($search);         }        return $result;  }  /**   * Gets a admin's record   *   * @param array $param an associative array with the following keys:<br><ul>   *        <li>adminid -  id of the admin's record to get</li></ul>   * @return array   * @access public   */  function modGetAdmin($param )   // Additional  {      include_once(MODOSDATE_DIR . 'admin_data.php');      $admin = new adminData();      $data = $admin->getRec($param['adminid']);     return $data;  }  /**   * Returns the picture album that match the provided keys.   * @param array $param an associative array with the following keys:<br><ul>   *             <li>id - id of the album</li>   *             <li>username - username of the album owner</li>   *             <li>name - name of the album</li></ul>   *   * @return array   * @access public   */  function modGetAlbum($param) // Additional  {         include_once(MODOSDATE_DIR . 'useralbums_data.php');         $albm = new userAlbumsData();         return $albm->getRec($param);  }  /**   * returns all available picture albums or if params are provide, returns all the albums that match those keys.   * @param array $param an associative array with the following keys:<br><ul>   *             <li>username - username of the album owner</li>   *             <li>name - name of the album</li></ul>   *   * @return array   * @access public   */  function modGetAllAlbums($param = false)  {         include_once(MODOSDATE_DIR . 'useralbums_data.php');         $albm = new userAlbumsData();         return $albm->getAllRec($param);  }  /**   * Returns all featured user profiles   *   * @return  array user ids of featured users   * @access public   */  function modGetAllFeatured( )  {      include_once(MODOSDATE_DIR . 'featured_profiles_data.php');      $feat = new featuredProfilesData();      $rows = $feat->getAllRec($search);      $data = array();      foreach ( $rows AS $id => $row ) {          if (   $row['id']              && $row['exposures'] < $row['req_exposures'] && time() >=  $row['start_date'] && time() <= $row['end_date'] ) {              $data[] = $row['userid'] ;          }      }      return $data;  }  /**   * returns all configured languages   *   * @return array   * @access public   */  function modGetAllLanguages( )  // Additional  {        $sql = "SELECT DISTINCT lang FROM ! ORDER BY lang";        $data =  $GLOBALS['db']->getAll($sql, array(LANGUAGE_TABLE));        $out = array();        foreach ($data AS $value ) {            $out[] = $value['lang'];        }        return $out;  }  /**   * returns all available pictures for a user / album   *   * @param array $param an associative array with the following keys:<br><ul>   *          <li>userid - user id of the user</li>   *          <li>album_id  - id of the album</li>   *          <li>active  - Y or N</li></ul>   * @return array <br>   * Example:<br><br>   * Array<br>   * (<br>   *     [0] => Array<br>   *         (<br>   *             [id] => 37<br>   *             [userid] => 104<br>   *             [picno] => 1<br>   *             [ins_time] => 1154301578<br>   *             [active] => Y<br>   *             [picext] => jpg<br>   *             [tnext] => jpg<br>   *             [album_id] => 0<br>   *         )<br>   * <br>   *     [1] => Array<br>   *         (<br>   *             [id] => 38<br>   *             [userid] => 104<br>   *             [picno] => 2<br>   *             [ins_time] => 1154301599<br>   *             [active] => Y<br>   *             [picext] => jpg<br>   *             [tnext] => jpg<br>   *             [album_id] => 0<br>   *         )<br>   * )<br>   * @access public   */  function modGetAllPictures( $param )  {      $pictures = array();      // Don't get the actual pictures or we'll run out of memeory      //      $opt['fields'] = array('id', 'userid', 'picno', 'ins_time', 'active', 'picext', 'tnext', 'album_id');      include_once(MODOSDATE_DIR . 'usersnaps_data.php');      $snap = new userSnapsData();      $pictures = $snap->getAllRec($param,$opt);      return $pictures;  }  /**   * Gets all user's records matching provided parameters   *   * @param array $param an associative array with any of the following keys:<br><ul>   *  <li>sort - field to sort by and direction (ex. "username ASC" or "username DESC"</li>   *  <li>limit - max number of records to return</li>   *  <li>id</li>   *  <li>active, </li>   *  <li>username</li>   *  <li>lastvisit</li>   *  <li>regdate</li>   *  <li>level</li>   *  <li>timezone</li>   *  <li>allow_viewonline</li>   *  <li>rank</li>   *  <li>email</li>   *  <li>country</li>   *  <li>actkey</li>   *  <li>firstname</li>   *  <li>lastname</li>   *  <li>gender</li>   *  <li>lookgender</li>   *  <li>lookagestart</li>   *  <li>lookageend</li>   *  <li>address_line1</li>   *  <li>address_line2</li>   *  <li>state_province</li>   *  <li>county</li>   *  <li>city</li>   *  <li>zip</li>   *  <li>birth_date</li>   *  <li>lookcountry</li>   *  <li>lookstate_province</li>   *  <li>lookcounty</li>   *  <li>lookcity</li>   *  <li>lookzip</li>   *  <li>lookradius</li>   *  <li>radiustype</li>   *  <li>picture</li>   *  <li>status</li>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -