📄 modplugin.php
字号:
* <li>levelend</li> * <li>levelend_date</li></ul> * @return array * @access public */ function modGetAllUsers($param ) // Additional { include_once(MODOSDATE_DIR . 'user_data.php'); $user = new userData(); $opt = false; if ( array_key_exists('sort', $param) ) { $opt['sort'] = $param['sort']; unset($param['sort']); } if ( array_key_exists('limit', $param) ) { $opt['limit'] = $param['limit']; unset($param['limit']); } if ( count($param) == 0 ) { unset($param); } $data = $user->getAllRec($param, $opt); $alldata = array(); // Get all doesn't get the statename, country name and age, so refetch // using modGetUser to get everything // foreach ( $data AS $value ) { $udata = $this->modGetUser( array('userid' => $value['id']) ); $alldata[] = array_merge($udata,$value); } return $alldata; } /** * returns a list of all available calendars * * @return array * @access public */ function modGetCalendars( ) { include_once(MODOSDATE_DIR . 'calendars_data.php'); $cal = new calendarsData(); return $cal->getAllRec(); } /** * returns a list of all available events for calendar X * * @param array $param an associative array with the following keys:<br><ul> * <li>calendarid - id of calendar</li></ul> * @return array * @access public */ function modGetEvents( $param ) { include_once(MODOSDATE_DIR . 'calendarevents_data.php'); $evnt = new calendarEventsData(); $search['calendarid'] = $param['calendarid']; return $evnt->getAllRec($search); } /** * Returns the current error messages * * @return array * @access public */ function modGetErrorMessage() { return $this->_errorMessage; } /** * returns the currently loaded language * * @return string * @access public */ function modGetLoadedLanguage( ) { $language = 'english'; if ( isset($_SESSION['opt_lang']) && $_SESSION['opt_lang'] != '' ) { $language = $_SESSION['opt_lang']; } return $language; } /** * Given a picture id, returns the picture * * @param array $param an associative array with the following keys:<br><ul> * <li>id - id of the picture</li> * <li>type - type of picture ('main' or 'thumbnail')</li></ul> * @return string * @access public */ function modGetPicture( $param ) // Additional { if ( isset($param['main']) ) { $type = 'tnpicture'; } elseif ( isset($param['thumbnail']) ) { $type = 'picture'; } else { $type = 'picture'; } include_once(MODOSDATE_DIR . 'usersnaps_data.php'); $albm = new userSnapsData(); $picture = $albm->getRecField($param['id'],$type); $albm->clrData(); return $picture; } /** * returns the value of any particular global configuration setting * * @param array $param an associative array with the following key:<br><ul> * <li>setting - name of the setting</li></ul> * @return string|int * @access public */ function modGetSetting( $param) { if (isset($GLOBALS['config'][ $param['setting'] ]) ) { $result = $GLOBALS['config'][ $param['setting'] ]; } else { $this->_setErrorMessage("Setting doesn't exist"); $result = false; } return $result; } /** * Gets a user's record * * @param array $param an associative array with the following key:<br><ul> * <li>userid - user id of the users record to get</li></ul> * @return array <br> * Example:<br> * Array<br> * (<br> * [id] => 104<br> * [active] => 1<br> * [username] => testuser<br> * [password] => 179ad45c6ce2cb97cf1029e212046e81<br> * [lastvisit] => 1154266346<br> * [regdate] => 1152972184<br> * [level] => 1 (role id)<br> * [timezone] => -10.00<br> * [allow_viewonline] => 1<br> * [rank] => 1<br> * [email] => dlhinkley@localhost.localdomain<br> * [country] => US<br> * [actkey] => bf45e84c32babfdcb9bce75381b7c8e5<br> * [firstname] => Test<br> * [lastname] => USer<br> * [gender] => M<br> * [lookgender] => F<br> * [lookagestart] => 16<br> * [lookageend] => 90<br> * [address_line1] => <br> * [address_line2] => <br> * [state_province] => AK<br> * [county] => sadff<br> * [city] => asdff<br> * [zip] => 12345<br> * [birth_date] => 1981-07-15<br> * [lookcountry] => US<br> * [lookstate_province] => AA<br> * [lookcounty] => <br> * [lookcity] => <br> * [lookzip] => <br> * [lookradius] => <br> * [radiustype] => <br> * [picture] => 0<br> * [status] => Active<br> * [levelend] => 1185113123<br> * [countryname] => United States<br> * [statename] => Alaska<br> * [countyname] => Herbertson<br> * [cityname] => New York<br> * [age] => 25<br> * [levelend_date] => 3-31-2006<br> * )<br> * @access public */ function modGetUser($param ) // Additional { include_once(MODOSDATE_DIR . 'user_data.php'); $user = new userData(); $data = $user->getRec($param['userid']); if ( $data ) { // Get the coutry name $sql = "select name from ".COUNTRIES_TABLE." where code = '".$data['country']."'"; $data['countryname'] = $user->getField('name', $sql); // Get the state name $sql = "select name from ".STATES_TABLE." where code = '".$data['state_province']."' and countrycode = '".$data['country']."'"; $data['statename'] = $user->getField('name',$sql); if (isset($data['county']) && $data['county'] != '') { // Get the county name $sql = "select name from ".COUNTIES_TABLE." where code = '".$data['county']."' and countrycode = '".$data['country']."' and statecode = '".$data['state_province']."'"; $x_countyname = $user->getField('name',$sql); if (isset($x_countyname) && $x_countyname != '') { $data['countyname'] = $x_countyname; } else { $data['countyname'] = $data['county']; } } if (isset($data['city']) && $data['city'] != '') { // Get the county name if ($data['county'] != '') { $sql = "select name from ".CITIES_TABLE." where code = '".$data['city']."' and countrycode = '".$data['country']."' and statecode = '".$data['state_province']."' and countycode = '".$data['county']."'" ; } else { $sql = "select name from ".CITIES_TABLE." where code = '".$data['city']."' and countrycode = '".$data['country']."' and statecode = '".$data['state_province']."' limit 1" ; } $x_cityname = $user->getField('name',$sql); if (isset($x_cityname) && $x_cityname != '') { $data['cityname'] = $x_cityname; } else { $data['cityname'] = $data['city']; } } $data['levelend_date'] = strftime(get_lang('DATE_FORMAT'),$data['levelend']); // Use sql to calculate age $sql = "SELECT floor((to_days('".date("Y-m-d")."')-to_days('".$data['birth_date']."'))/365.25) as age"; $data['age'] = $user->getField('age',$sql); $sql = "select count(*) as cnt from ".USER_SNAP_TABLE." where userid = '".$data['id']."' and ( album_id = 0 or album_id is null ) "; $data['photos_cnt'] = $user->getField('cnt',$sql); } return $data; } /** * check to see if the user has permission to access resource X * * @param array $param an associative array with the following keys:<br><ul> * <li>userid - user id of the user to logout</li> * <li>resource - name of the resource one of ( chat, forum, blog, poll, includeinsearch, message, message_keep_days, allowim, uploadpicture, uploadpicturecnt, allowalbum, event_mgt, seepictureprofile, favouritelist, sendwinks, extsearch, fullsignup)</li></ul> * @return bool True on success. False on failure. * @access public */ function modHasPermission( $param ) { $permission = true; include_once(MODOSDATE_DIR . 'user_data.php'); $user = new userData(); $user->getRec($param['userid']); if ( ! $user->getData('active') ) { $permission = false; } else { $search['roleid'] = $user->getData('level'); $mdata = $this->modGetMembershipPriviledges($search); if ( ! $mdata[ $param['resource'] ] ) { $permission = false; } } return $permission; } /** * check to see if user X is banned for user Y * * @param array $param an associative array with the following keys:<br><ul> * userid - user id of the user to check * <li>type - type of ban to check, B for ban, H for hotlist, F for buddy</li></ul> * @return bool true for banned false for not banned * @access public */ function modIsBanned( $param) { $result = false; $user = $this->modGetUser( array('userid' => $param['userid']) ); $refuser = $this->modGetUser(array('userid' => $param['ref_userid']) ); if ( ! isset($user['username']) ) { $this->_setErrorMessage("Userid doesn't exist"); $result = false; } elseif ( ! isset($refuser['username']) ) { $this->_setErrorMessage("Refering 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['ref_username'] = $refuser['username']; //$search[' $bud->getRec($search); if ( $bud->getData('id') ) { $result = true; } } return $result; } /** * determines if a user's profile is featured * * @param array $param an associative array with the following keys:<br><ul> * <li>userid - user id</li></ul> * @return bool True if featured. False if not featured. * @access public */ function modIsFeatured( $param ) { include_once(MODOSDATE_DIR . 'featured_profiles_data.php'); $feat = new featuredProfilesData(); $search['userid'] = $param['userid']; $feat->getRec($search); if ( $feat->getData('id') && $feat->getData('exposures') < $feat->getData('req_exposures') && time() >= $feat->getData('start_date') && time() <= $feat->getData('end_date') ) { $featured = true; } else { $featured = false; } return $featured; } /** * check to see if user with id is logged in * * @param array $param an associative array with the following keys: <br><ul> * <li>userid - the user id of the user</li></ul> * @return bool True if logged in. False if not logged in. * @access public */ function modIsLoggedIn( $param ) { include_once(MODOSDATE_DIR . 'onlineusers_data.php'); $d = new onlineusersData(); $search['userid'] = $param['userid']; $d->getRec($search); return $d->getData('userid'); } /** * logout the current user * * @param array $param an associative array with the following keys:<br><ul> * <li>userid - the user id of the user to logout </li></ul> * @return bool True on success. False on failure. * @access public */ function modLogout( $param) { global $config, $cookie; include_once(MODOSDATE_DIR . 'onlineusers_data.php'); $d = new onlineusersData(); $search['userid'] = $param['userid']; $d->deleteRec($search); session_destroy(); unset( $_COOKIE[$config['cookie_prefix'].'osdate_info'] ); unset( $cookie ); unset( $_SESSION ); return $this->_setStatus($d); } /** * sets/unsets a user's profile as featured * * @param array $param an associative array with the following keys:<br><ul> * <li>userid</li> * <li>start_date - year-mo-day (ex 2006-07-15) </li> * <li>end_date - year-mo-day (ex 2006-07-15) </li> * <li>must_show - 1 or 0 </li> * <li>req_exposures - required exposures</li></ul> * @return bool True on success. False on failure. * @access public */ function modMakeFeatured($param ) { include_once(MODOSDATE_DIR . 'featured_profiles_data.php'); $feat = new featuredProfilesData(); $data = array(
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -