مشغل (توضيح): الفرق بين النسختين

[مراجعة غير مفحوصة][مراجعة غير مفحوصة]
تم حذف المحتوى تمت إضافة المحتوى
YurikBot (نقاش | مساهمات)
لا ملخص تعديل
سطر 1:
<?php
المشغل أو Operator :
// #############################################################################
// psiStats 2006 for vBulletin 3.5.0 - Hack by Anthony Kanevsky (ankan925@optonline.net) - aka Psionic Vision
// Main File - Last Updated: January 02, 2006 11:28AM
// Rentacoder ID: 1360893
// Distributed under GPL license for non-commercial use.
// #############################################################################
 
// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // |
* في الرياضيات : يدعى [[مؤثر|المشغل او المؤثر]] و هو نوع من الدوال الرياضيى المطبقة على دوال أخرى .
// ############################################################################# // |
* في الفيزياء : [[مؤثر (فيزياء)|المشغل او المؤثر في الفيزياء]]
error_reporting(E_ALL & ~E_NOTICE); // |
* في اليويلوجيا : [[مشغل (أحياء)|المشغل]] قطعة من الدنا تنظم فعالية الجينات .
// |
* في المعلوماتية و البرمجة: [[مشغل (برمجة)|مشغل برمجي]] نوع من أنواع البرامج .
// ############################################################################# // |
* في [[الآي آر سي]] IRC : [[مشغل (آي آر سي)]] منظم الاتصالات في أنظمة المحادثة الحية .
$_REQUEST['do'] = (!isset($_REQUEST['do']) ? 'home' : $_REQUEST['do']); // |
* في مجال التقنيات : المشغل هو احد التجهيزات التي توفر خدمة معينة :مثل [[مشغل الهاتف]] telephone operator , [[مشغل المذياع]] radio operator .
// |
// ############################################################################# // |
define('THIS_SCRIPT', 'psistats'); // |
define('ONE_DAY', 86400); // |
define('ONE_MONTH', 2629743.83); // |
// |
// ############################################################################# // |
function fetch_percent_color(&$color, &$percent, &$real_percent, $this_count, $total_count) // |
{ // |
$color = rand(1,6); // |
$real_percent = round($this_count / $total_count * 100, 2); // |
$percent = ($real_percent >= 70 ? 70 + ($real_percent - 70) / 4 : $real_percent); // |
} // |
// |
function fetch_sum(&$mysql_resource) // |
{ // |
global $db; // |
while ($item = $db->fetch_array($mysql_resource)) // |
{ // |
$total += $item['count']; // |
} // |
$db->data_seek($mysql_resource, 0); // |
return $total; // |
} // |
// |
// ############################################################################# // |
$phrasegroups = array('psistats'); // |
// |
$specialtemplates = array(); // |
// |
$globaltemplates = array( // |
'psistats_footer' // |
); // |
// |
$actiontemplates = array( // |
'home' => array( // |
'PSISTATS_HOME' // |
), // |
'styles' => array( // |
'PSISTATS_STYLES', // |
'psistats_stylebit' // |
), // |
'toptf' => array( // |
'PSISTATS_TOPTF', // |
'psistats_topthreadbit', // |
'psistats_topforumbit' // |
), // |
'display' => array( // |
'PSISTATS_DISPLAY', // |
'psistats_resolutionbit', // |
'psistats_depthbit' // |
), // |
'regions' => array( // |
'PSISTATS_REGIONS', // |
'psistats_regionbit', // |
'psistats_countrybit' // |
), // |
'os' => array( // |
'PSISTATS_OS', // |
'psistats_browserbit', // |
'psistats_osbit' // |
), // |
'refsites' => array( // |
'PSISTATS_REFSITES', // |
'psistats_refsitebit', // |
), // |
); // |
// |
// ############################################################################# // |
if (in_array($_REQUEST['do'], array_keys($actiontemplates))) // |
{ // |
define('OUTPUT', true); // |
} // |
// |
// ############################################################################# // |
require_once('./global.php'); // |
// ############################################################################# // |
// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // |
 
// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // |
// ############################################################################# // |
$canview = true; // |
// |
if (trim($vbulletin->options['psistats_ugslimit'])) // |
{ // |
if (preg_match('/^([0-9]{1,2}[\s]*[,]{0,1}[\s]*)*$/', $vbulletin->options['psistats_ugslimit'])) // |
{ // |
eval('$canview = is_member_of($vbulletin->userinfo, ' . $vbulletin->options['psistats_ugslimit'] . ');');
} // |
} // |
// |
if (!$canview) // |
{ // |
print_no_permission(); // |
} // |
// |
// ############################################################################# // |
$navbits = array(); // |
$navbits[$parent] = 'ÇáÅÍÕÇÆíÇÊ ÇáÔÇãáÉ'; // |
// |
$maintemplate = false; // |
// ############################################################################# // |
// ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- // |
 
################################################################################################################################
################################################################################################################################
################################################################################################################################
 
if ($_REQUEST['do'] == 'home')
{{توضيح}}
{
// init important variables
$r = array(); // referrers
$u = array(); // userid => usename cache
$c = array(
'creation_date' => 0, // board creation date
'creation_fdate' => 0, // board creation date (formatted)
'creation_dayspassed' => 0, // days passed since board creation
'posts_per_day' => 0, // posts per day (average)
'lastuserid' => 0, // last registered user
'lastusername' => '', // last registered user
'maxrefs' => 0, // maximum referrals
'maxrefs_userid' => 0, // -> userid
'maxrefs_username' => '', // -> username
'users' => 0, // total users
'staff' => 0, // total staff
'administrators' => 0, // -> admins
'smoderators' => 0, // -> smods
'moderators' => 0, // -> mods
'registered_today' => 0, // users registered during last 24 hours
'active_users' => 0, // active users
'nonactive_users' => 0, // nonactive users
'activity' => 0, // activity %
'online' => 0, // online users (total)
'online_users' => 0, // online users (registered only)
'online_guests' => 0, // online users (guests only)
'threads' => 0, // total threads
'threads_today' => 0, // total threads (24 hrs)
'threadviews' => 0, // thread views
'posts' => 0, // total posts
'posts_today' => 0, // total posts (24 hrs)
'pmtotal' => 0, // total private messages
);
 
// user info
[[de:Operator]]
$users = $db->query_read("
[[en:Operator (disambiguation)]]
SELECT user.userid, user.username, user.usergroupid, user.membergroupids, joindate, lastpost, pmtotal, referrerid,
[[fr:Opérateur]]
IF(NOT ISNULL(moderator.moderatorid), 1, 0) as ismoderator,
[[it:Operatore (disambigua)]]
IF((usergroup.adminpermissions & " . $vbulletin->bf_ugp_adminpermissions['cancontrolpanel'] . "), 1, 0) as isadministrator,
[[ru:Оператор]]
IF((usergroup.adminpermissions & " . $vbulletin->bf_ugp_adminpermissions['ismoderator'] . "), 1, 0) as issupermoderator
[[uk:Оператор]]
FROM " . TABLE_PREFIX . "user as user
LEFT JOIN " . TABLE_PREFIX . "moderator as moderator ON (user.userid = moderator.userid)
LEFT JOIN " . TABLE_PREFIX . "usergroup as usergroup ON (user.usergroupid = usergroup.usergroupid)
ORDER BY user.joindate DESC
");
while ($user = $db->fetch_array($users))
{
// append username cache
$u["$user[userid]"] = $user['username'];
// if this user has a referrer, increase the referrer's referral count
if ($user['referrerid'])
{
$r["$user[referrerid]"]['refcount']++;
}
// set board creation date based on user #1's joindate
if ($user['userid'] == 1)
{
$c['creation_date'] = $user['joindate'];
}
// get last registered user (that'll be the first user in mysql results)
if (!$c['users'])
{
$c['lastuserid'] = $user['userid'];
$c['lastusername'] = $user['username'];
}
// increate total usercount
$c['users']++;
// increase total pmcount
$c['pmtotal'] += $user['pmtotal'];
// increase staff count
if ($user['isadministrator'])
{
$c['administrators']++;
}
else if ($user['issupermoderator'])
{
$c['smoderators']++;
}
else if ($user['ismoderator'])
{
$c['moderators']++;
}
// incresase users registered today count
if (TIMENOW - $user['joindate'] < ONE_DAY)
{
$c['registered_today']++;
}
// incresase active/nonactive count
if (TIMENOW - $user['lastpost'] < ONE_MONTH)
{
$c['active_users']++;
}
else
{
$c['nonactive_users']++;
}
}
 
// get greatest referrer
foreach ($r as $ref_id => $ref_info)
{
if ($ref_info['refcount'] > $c['maxrefs'])
{
$c['maxrefs'] = $ref_info['refcount'];
$c['maxrefs_userid'] = $ref_id;
$c['maxrefs_username'] = $u["$ref_id"];
}
}
// get total staff members
$c['staff'] = $c['administrators'] + $c['smoderators'] + $c['moderators'];
// get activity percent
$c['activity'] = $c['nonactive_users'] ? round($c['active_users'] / $c['users'] * 100, 2) : 100;
// get online users
$users_online = $db->query_read("
SELECT session.userid
FROM " . TABLE_PREFIX . "session as session
" . (!($vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canseehidden']) ? "LEFT JOIN " . TABLE_PREFIX . "user as user USING (userid) WHERE NOT (user.options & " . $vbulletin->bf_misc_useroptions['invisible'] . ")" : "") . "
");
while ($user = $db->fetch_array($users_online))
{
$user['userid'] ? $c['online_users']++ : $c['online_guests']++;
}
$c['online'] = $c['online_users'] + $c['online_guests'];
// thread info
$threads = $db->query_read("
SELECT dateline, views
FROM " . TABLE_PREFIX . "thread
WHERE visible = 1
");
while ($thread = $db->fetch_array($threads))
{
$c['threads']++;
$c['threadviews'] += $thread['views'];
if (TIMENOW - $thread['dateline'] < ONE_DAY)
{
$c['threads_today']++;
}
}
// post info
$posts = $db->query_read("
SELECT dateline
FROM " . TABLE_PREFIX . "post
WHERE visible = 1
");
while ($post = $db->fetch_array($posts))
{
$c['posts']++;
if (TIMENOW - $post['dateline'] < ONE_DAY)
{
$c['posts_today']++;
}
}
// apply board creation date, if found
if ($c['creation_date'])
{
$c['creation_fdate'] = vbdate($vbulletin->options['dateformat'], $c['creation_date']);
$c['creation_dayspassed'] = ceil((TIMENOW - $c['creation_date']) / 86400);
$c['posts_per_day'] = round($c['creation_dayspassed'] / $c['posts'], 2);
}
}
 
################################################################################################################################
################################################################################################################################
################################################################################################################################
 
if ($_REQUEST['do'] == 'styles')
{
// init important variables
$totalusers = 0;
$stylecache = array();
// fetch styles
$getstyles = $db->query_read("
SELECT styleid, title
FROM " . TABLE_PREFIX . "style
WHERE userselect = 1
");
while ($style = $db->fetch_array($getstyles))
{
$stylecache["$style[styleid]"] = array_merge($style, array('count' => 0));
}
 
// fetch users
$getusers = $db->query_read("
SELECT IF(styleid > 0, styleid, " . $vbulletin->options['styleid'] . ") as styleid
FROM " . TABLE_PREFIX . "user
");
while ($user = $db->fetch_array($getusers))
{
$totalusers++;
$stylecache["$user[styleid]"]['count']++;
}
// fetch output
foreach($stylecache as $styleid => $style)
{
fetch_percent_color(&$color, &$percent, &$real_percent, $style['count'], $totalusers);
eval('$stylebit .= "' . fetch_template('psistats_stylebit') . '";');
}
}
 
################################################################################################################################
################################################################################################################################
################################################################################################################################
 
if ($_REQUEST['do'] == 'toptf')
{
// top threads by views
$getthreads = $db->query_read("
SELECT threadid, title, views
FROM " . TABLE_PREFIX . "thread
WHERE visible = 1
ORDER BY views DESC
LIMIT " . $vbulletin->options['psistats_toptflimit'] . "
");
while ($thread = $db->fetch_array($getthreads))
{
eval('$vtopthreadbit .= "' . fetch_template('psistats_topthreadbit') . '";');
}
// top threads by replies
$getthreads = $db->query_read("
SELECT threadid, title, replycount
FROM " . TABLE_PREFIX . "thread
WHERE visible = 1 AND replycount > 0
ORDER BY replycount DESC
LIMIT " . $vbulletin->options['psistats_toptflimit'] . "
");
while ($thread = $db->fetch_array($getthreads))
{
eval('$rtopthreadbit .= "' . fetch_template('psistats_topthreadbit') . '";');
}
// top forums by thread/reply count
$getforums = $db->query_read("
SELECT forumid, title, threadcount+replycount as acount
FROM " . TABLE_PREFIX . "forum
WHERE (options & " . $vbulletin->bf_misc_forumoptions['cancontainthreads'] . ")
ORDER BY threadcount+replycount DESC
LIMIT " . $vbulletin->options['psistats_toptflimit'] . "
");
while ($forum = $db->fetch_array($getforums))
{
eval('$topforumbit .= "' . fetch_template('psistats_topforumbit') . '";');
}
}
 
################################################################################################################################
################################################################################################################################
################################################################################################################################
 
if ($_REQUEST['do'] == 'display')
{
// fetch resolutions
$getresolutions = $db->query_read("
SELECT *
FROM " . TABLE_PREFIX . "psistats_screenresolution
ORDER BY resolution
");
if ($db->num_rows($getresolutions))
{
$total_count = fetch_sum(&$getresolutions);
while ($resolution = $db->fetch_array($getresolutions))
{
fetch_percent_color(&$color, &$percent, &$real_percent, $resolution['count'], $total_count);
eval('$resolutionbit .= "' . fetch_template('psistats_resolutionbit') . '";');
}
}
// fetch depths
$getdepths = $db->query_read("
SELECT *
FROM " . TABLE_PREFIX . "psistats_screendepth
ORDER BY depth
");
if ($db->num_rows($getdepths))
{
$total_count = fetch_sum(&$getdepths);
while ($depth = $db->fetch_array($getdepths))
{
$depth['depth'] = explode(',', $depth['depth']);
$depth['bits'] = trim($depth['depth'][0]);
$depth['colors'] = trim($depth['depth'][1]);
fetch_percent_color(&$color, &$percent, &$real_percent, $depth['count'], $total_count);
eval('$depthbit .= "' . fetch_template('psistats_depthbit') . '";');
}
}
}
 
################################################################################################################################
################################################################################################################################
################################################################################################################################
 
if ($_REQUEST['do'] == 'regions')
{
// init important variables
$regioncache = array();
 
// require back-end files
require_once(DIR . '/psistats/database_country.php');
 
// fetch countries
$getcountries = $db->query_read("
SELECT *
FROM " . TABLE_PREFIX ."psistats_country
ORDER BY code
");
if ($db->num_rows($getcountries))
{
$total_count = fetch_sum(&$getcountries);
while ($country = $db->fetch_array($getcountries))
{
$country['name'] = $database_country["$country[code]"][0];
$country['region'] = $database_country["$country[code]"][1];
$country['capital'] = $database_country["$country[code]"][2];
$country['currency'] = $database_country["$country[code]"][3];
$country['code'] = strtolower($country['code']);
$country['flagfile'] = (!file_exists(DIR . '/psistats/database_flags/' . $country['code'] . '.gif')) ? 'noflag' : $country['code'];
$regioncache["$country[region]"] += $country['count'];
$regioncache_total += $country['count'];
fetch_percent_color(&$color, &$percent, &$real_percent, $country['count'], $total_count);
eval('$countrybit .= "' . fetch_template('psistats_countrybit') . '";');
}
// fetch continents based on countries
foreach ($regioncache as $region => $count)
{
fetch_percent_color(&$color, &$percent, &$real_percent, $count, $regioncache_total);
eval('$regionbit .= "' . fetch_template('psistats_regionbit') . '";');
}
}
}
 
################################################################################################################################
################################################################################################################################
################################################################################################################################
 
if ($_REQUEST['do'] == 'os')
{
// fetch browsers
$getbrowsers = $db->query_read("
SELECT *
FROM " . TABLE_PREFIX ."psistats_browser
ORDER BY browser, version ASC
");
if ($db->num_rows($getbrowsers))
{
$total_count = fetch_sum(&$getbrowsers);
while ($browser = $db->fetch_array($getbrowsers))
{
$browserimage = strtolower(str_replace(' ', '', $browser['browser']));
if (!file_exists(DIR . '/psistats/database_agents/' . $browserimage . '.gif'))
{
switch ($browser['browser'])
{
case 'Mozilla':
case 'Firefox':
$browserimage = 'mozilla';
break;
case 'Bot':
$browserimage = 'crawler';
break;
default:
$browserimage = 'nobrowser';
break;
}
}
 
fetch_percent_color(&$color, &$percent, &$real_percent, $browser['count'], $total_count);
eval('$browserbit .= "' . fetch_template('psistats_browserbit') . '";');
}
}
// fetch oses
$getoses = $db->query_read("
SELECT *
FROM " . TABLE_PREFIX ."psistats_os
ORDER BY os ASC
");
if ($db->num_rows($getoses))
{
$total_count = fetch_sum(&$getoses);
while ($os = $db->fetch_array($getoses))
{
switch ($os['os'])
{
case 'Windows 98':
case 'Windows ME':
case 'Windows NT':
case 'Windows 2000':
$osimage = 'windows';
break;
case 'Windows XP':
case 'Windows Vista':
case 'Windows 2003 Server':
$osimage = 'windowsxp';
break;
case 'Windows CE':
$osimage = 'windowsce';
break;
default:
$osimage = strtolower(str_replace(' ', '', $os['os']));
if (!file_exists(DIR . '/psistats/database_os/' . $osimage . '.gif'))
{
$osimage = 'noos';
}
break;
}
fetch_percent_color(&$color, &$percent, &$real_percent, $os['count'], $total_count);
eval('$osbit .= "' . fetch_template('psistats_osbit') . '";');
}
}
}
 
################################################################################################################################
################################################################################################################################
################################################################################################################################
 
if ($_REQUEST['do'] == 'refsites')
{
// fetch referring sites
$getsites = $db->query_read("
SELECT *
FROM " . TABLE_PREFIX ."psistats_referrer
WHERE banned = 0
ORDER BY dateline, referrer
LIMIT " . $vbulletin->options['psistats_refsitelimit'] . "
");
if ($db->num_rows($getsites))
{
$total_count = fetch_sum(&$getsites);
while ($site = $db->fetch_array($getsites))
{
fetch_percent_color(&$color, &$percent, &$real_percent, $site['count'], $total_count);
eval('$refsitebit .= "' . fetch_template('psistats_refsitebit') . '";');
}
}
}
 
################################################################################################################################
################################################################################################################################
################################################################################################################################
 
if (defined('OUTPUT'))
{
$version = '1.2.5';
$navbits[] = $vbphrase["psistats_$_REQUEST[do]"];
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('$psistats_footer = "' . fetch_template('psistats_footer') . '";');
eval('print_output("' . fetch_template('PSISTATS_' . strtoupper($_REQUEST['do'])) . '");');
}
 
################################################################################################################################
################################################################################################################################
################################################################################################################################
 
if ($_REQUEST['do'] == 'update_info')
{ // ajax stuff
$vbulletin->input->clean_array_gpc('r', array(
'width' => TYPE_UINT,
'height' => TYPE_UINT,
'depth' => TYPE_UINT
));
 
if ($resolution_check = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "psistats_screenresolution WHERE resolution = '" . $vbulletin->GPC['width'] . "x" . $vbulletin->GPC['height'] . "' LIMIT 1"))
{
$db->query_write("
UPDATE " . TABLE_PREFIX . "psistats_screenresolution
SET count = count + 1
WHERE resolution = '" . $vbulletin->GPC['width'] . "x" . $vbulletin->GPC['height'] . "'
");
}
else
{
$db->query_write("
INSERT INTO " . TABLE_PREFIX . "psistats_screenresolution
VALUES ('" . $vbulletin->GPC['width'] . "x" . $vbulletin->GPC['height'] . "', 1)
");
}
switch ($vbulletin->GPC['depth'])
{
case 4:
$vbulletin->GPC['colors'] = '16';
$depth_handled = true;
break;
case 8:
$vbulletin->GPC['colors'] = '256';
$depth_handled = true;
break;
case 16:
$vbulletin->GPC['colors'] = 'True Color';
$depth_handled = true;
break;
case 24:
case 32:
$vbulletin->GPC['colors'] = 'High Color';
$depth_handled = true;
break;
default:
$depth_handled = false;
if ($vbulletin->GPC['depth'] > 32)
{
$vbulletin->GPC['depth'] = 32;
$vbulletin->GPC['colors'] = 'High Color';
$depth_handled = true;
}
break;
}
if ($depth_handled)
{
if ($depth_check = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "psistats_screendepth WHERE depth = '" . $vbulletin->GPC['depth'] . "," . $vbulletin->GPC['colors'] . "' LIMIT 1"))
{
$db->query_write("
UPDATE " . TABLE_PREFIX . "psistats_screendepth
SET count = count + 1
WHERE depth = '" . $vbulletin->GPC['depth'] . "," . $vbulletin->GPC['colors'] . "'
");
}
else
{
$db->query_write("
INSERT INTO " . TABLE_PREFIX . "psistats_screendepth
VALUES ('" . $vbulletin->GPC['depth'] . "," . $vbulletin->GPC['colors'] . "', 1)
");
}
}
}
 
// #############################################################################
// psiStats 2006 for vBulletin 3.5.0 - Hack by Anthony Kanevsky (ankan925@optonline.net) - aka Psionic Vision - END
// #############################################################################
?>