<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- $Header: d:\cvs/3.8/Unread-posts.xml,v 1.5 2009/02/17 19:58:18 pem Exp $ -->
<product productid="paulm_dup_38" active="1">
	<title>هاك المشاركات الغير مقروءه والتقييمات</title>
	<description> www.n4fs.com/vb الهاك يعرض لك المشاركات الغير مقروءه وتعليقات التقييمات الغير مقروه في الناف بار  الهاك تعريب أنفاس</description>
	<version>3.8.002</version>
	<url/>
	<versioncheckurl/>
	<cvs><![CDATA[$Revision: 1.5 $]]></cvs>
	<dependencies>
		<dependency dependencytype="vbulletin" minversion="3.8.0" maxversion="3.8.99" />
	</dependencies>
	<codes>
		<code version="*">
			<installcode><![CDATA[
// Start v3.8.003 //
$pidlist = array(
'paulm_20050918',
'paulm_dup_37',
);
echo "<br />";
echo "<center>Please remember to <b>Mark as Installed</b> at vBulletin.org</center>";
echo "<br />";
echo "<center>Install Information</center>";
echo "<br />";
vbflush(); 
if (!empty($pidlist))
{
	foreach ($pidlist as $oldpid)
	{
		$check = $db->query_first_slave("
			SELECT version FROM ".TABLE_PREFIX."product WHERE productid = '".$db->escape_string($oldpid)."'
		");
		if ($check['version'])
		{
			delete_product($oldpid);
			echo "<center><font color='red'>A previous modification has automatically been removed : pid = $oldpid</font></center>";
			echo "<br />";
			vbflush(); 
			sleep(2);
		}
	}
}
$info['cvs'] = trim(substr(substr($arr['cvs'],10),0,-1));
if ($vbulletin->options['pemdata38'])
{
	$data = unserialize($vbulletin->options['pemdata38']);
	$prev = $data[$info['productid']];
	$data[$info['productid']] = $info;
	$productdata = $db->escape_string(serialize($data));
	$db->query_write("UPDATE ".TABLE_PREFIX."setting SET value = '$productdata' where varname = 'pemdata38'");
}
else
{
	$data[$info['productid']] = $info;
	$productdata = $db->escape_string(serialize($data));
	$db->query_write("
		REPLACE INTO ".TABLE_PREFIX."phrase 
		(varname, fieldname, product, text)
		VALUES ('setting_pemdata38_desc','vbsettings','pem-dummy-product','Leave this setting alone.'),
		       ('setting_pemdata38_title','vbsettings','pem-dummy-product','Modification Version Data (3.8)')
	");
	$db->query_write("
		REPLACE INTO ".TABLE_PREFIX."setting 
		(varname, value, optioncode, displayorder, grouptitle, defaultvalue, volatile, product)
		VALUES ('pemdata38','$productdata','',999,'version','',1,'pem-dummy-product')
	");
}
$info['url'] = 'http://www.vbulletin.org/forum/misc.php?do=producthelp&pid='.$info['productid'];
$info['versioncheckurl'] = 'http://www.vbulletin.org/forum/misc.php?do=productcheck&pid='.$info['productid'];
// End //]]></installcode>
			<uninstallcode />
		</code>
		<code version="3.8.000">
			<installcode><![CDATA[		
$indexfound = false;
echo "<center>Checking for Index</center>";
vbflush();
$indexdata = $vbulletin->db->query_read_slave("SHOW INDEX FROM " . TABLE_PREFIX . "post");
while ($indexlist = $vbulletin->db->fetch_array($indexdata))
{
	if ($indexlist['Key_name'] == 'dateline')
	{
		$indexfound = true;
	}
}
if (!$indexfound)
{
	echo "<center>Adding Index</center>";
	vbflush();
	$db->query_write("ALTER TABLE " . TABLE_PREFIX . "post ADD INDEX (dateline)");
}
$notfound = true;
echo '<center>Checking User Table</center>'; 
vbflush();
$data = $db->query_read_slave("SHOW COLUMNS FROM ".TABLE_PREFIX."user");
while ($list = $db->fetch_array($data))
{
	if ($list['Field'] == 'lastrepcheck') $notfound = false;
}
if ($notfound)
{
	echo "<center>Adding Column to User Table</center>";
	vbflush();
	$db->query_write("ALTER TABLE ".TABLE_PREFIX."user ADD lastrepcheck INT(10) UNSIGNED NOT NULL");
	$db->query_write("UPDATE ".TABLE_PREFIX."user SET lastrepcheck = lastvisit");
}
]]></installcode>
			<uninstallcode><![CDATA[
echo "<center>Checking User Table</center>";
vbflush();
$data = $db->query_read_slave("SHOW COLUMNS FROM ".TABLE_PREFIX."user");
while ($list = $db->fetch_array($data))
{
	if ($list['Field'] == 'lastrepcheck')
    {
		echo "<center>Removing Column from User Table</center>";
		vbflush();
        $db->query_write("ALTER TABLE ".TABLE_PREFIX."user DROP lastrepcheck");
    }
}
]]></uninstallcode>
		</code>
		<code version="*">
			<installcode><![CDATA[
// Display Version Information //
echo "<br />";
echo "<center>{$info['title']}</center>";
echo "<br />";
echo "<center>Installing : Version {$info['version']} ; Revision {$info['cvs']}</center>";
echo "<br />";
if ($prev['cvs'])
{
	echo "<center>( Replacing : Version {$prev['version']} ; Revision {$prev['cvs']} )</center><br />";
}
// Wait //
vbflush();
echo "<br /><br />";
vbflush();
sleep(6);
// End //]]></installcode>
			<uninstallcode />
		</code>
	</codes>
	<templates>
	</templates>
	<plugins>
		<plugin active="1" executionorder="5">
			<title>Unread Posts and Reputation (1)</title>
			<hookname>notifications_list</hookname>
			<phpcode><![CDATA[
if ($vbulletin->options['dupnote'] AND $vbulletin->options['duprep'])
{
	$notifications['dup_repcount'] = array(
		'phrase' => $vbphrase['dup_new_reputation'],
		'link'   => $vbulletin->options['duppath'].'usercp.php?'.$vbulletin->session->vars['sessionurl'],
		'order'  => 11
	);
}
]]></phpcode>
		</plugin>
		<plugin active="1" executionorder="5">
			<title>Unread Posts and Reputation (2)</title>
			<hookname>parse_templates</hookname>
			<phpcode><![CDATA[
if ($vbulletin->userinfo['userid'])
{
	if ($vbulletin->options['threadmarking'] AND $vbulletin->options['duppost'])
	{
		$optout = array();
		$eforums = array(); 
		$fids = array_keys($vbulletin->forumcache);

		if ($vbulletin->options['dupexcl'])
		{
			$eforums = explode(',',$vbulletin->options['dupexcl']);
		}

		if ($vbulletin->products['optoutgnp'] AND $vbulletin->userinfo['excludeforumsgnp'])
		{
			$optout = explode(',', $vbulletin->userinfo['excludeforumsgnp']);
		}

		foreach ($fids AS $key => $xid)
		{
			if (
				in_array($xid,$eforums) // Exclude forums selected in this Modifications options
				OR in_array($xid,$optout) // Exclude forums selected in Get New/Get Daily Opt Out Modification (by Andreas)
				OR !($vbulletin->userinfo['forumpermissions'][$xid] & $vbulletin->bf_ugp_forumpermissions['canview']) 
				OR !($vbulletin->userinfo['forumpermissions'][$xid] & $vbulletin->bf_ugp_forumpermissions['canviewthreads'])
			)
			{
				unset($fids[$key]);
			}
		}

		$flist = implode(',',$fids);

		if ($vbulletin->options['duppost'] == 1)
		{
			$cutoff = $vbulletin->userinfo['lastvisit'];
		}
		else
		{
			$cutoff = TIMENOW - ($vbulletin->options['markinglimit'] * 86400);
		}

		if ($vbulletin->options['duplimit'] AND
			$cutoff < (TIMENOW - ($vbulletin->options['duplimit'] * 86400))
			)
		{
			$limit = true;
		}
		else
		{
	        $limit = false;
		}
		
		if (!$limit)
		{
			can_moderate() ? $in = '0,1,2' : $in = '1';

			$postcount = $vbulletin->db->query_first_slave("
				SELECT COUNT(post.postid) as unread
				FROM " . TABLE_PREFIX . "post as post FORCE INDEX (dateline)
				INNER JOIN " . TABLE_PREFIX . "thread as thread USING (threadid)
				INNER JOIN " . TABLE_PREFIX . "forum AS forum USING (forumid)
				LEFT JOIN " . TABLE_PREFIX . "threadread AS threadread ON (threadread.threadid = thread.threadid AND threadread.userid = {$vbulletin->userinfo['userid']})
				LEFT JOIN " . TABLE_PREFIX . "forumread AS forumread ON (forumread.forumid = forum.forumid AND forumread.userid = {$vbulletin->userinfo['userid']})
				WHERE thread.forumid IN(0$flist) AND thread.visible IN ($in)
				AND post.dateline > IF(threadread.readtime IS NULL, $cutoff, threadread.readtime)
				AND post.dateline > IF(forumread.readtime IS NULL, $cutoff, forumread.readtime)
				AND post.dateline > $cutoff
				AND thread.lastpost > IF(threadread.readtime IS NULL, $cutoff, threadread.readtime)
				AND thread.lastpost > IF(forumread.readtime IS NULL, $cutoff, forumread.readtime)
				AND thread.lastpost > $cutoff
			");
		}

		if ($vbulletin->options['duppost'] == 1)
		{
			$vbphrase['dup_posts'] = $vbphrase['dup_posts_visit'];
			$vbphrase['dup_no_posts'] = $vbphrase['dup_no_posts_visit'];
		}

		if ($limit)
		{
			$postcount['unread'] = 0;
			$vbphrase['dup_no_posts'] = $vbphrase['dup_unread_posts'];
		}

		if ($postcount['unread'] == 0)
		{
			$unread = construct_phrase($vbphrase['dup_no_posts'],$vbulletin->options['duppath']); 
		}
		else
		{
			if ($postcount['unread'] == 1)
			{
				$unread = construct_phrase($vbphrase['dup_posts'],$postcount['unread'],$vbphrase['dup_single_post'],$vbulletin->options['duppath']); 
			}
			else
			{
				$unread = construct_phrase($vbphrase['dup_posts'],$postcount['unread'],$vbphrase['dup_plural_post'],$vbulletin->options['duppath']);  
			}		
		}		

		$pid = 'paulm_dup_38';
		if ($pemdata38['set'] == true)
		{
			$data_dup =& $pemdata38[$pid];
		}
		else
		{
			if ($pemdata38 = unserialize($vbulletin->options['pemdata38']))
			{
				$pemdata38['set'] = true;
				$data_dup =& $pemdata38[$pid];
			}
			else
			{
				$data_dup = array('version' => 'N/A');
			}
	 	}

		$vbphrase['welcome_x'] .= '</strong><br />'.$unread.'<strong>'; // 3.6 Phrase
		$vbphrase['welcome_x_link_y'] .= '</strong><br />'.$unread.'<strong>'; // 3.7 Onwards Phrase
		$vbphrase['last_visited_x_at_y'] .= "<!-- PEMDATA38: {$data_dup['title']} : Version = {$data_dup['version']} : Revision = {$data_dup['cvs']} -->";
 	}

	$userid = intval($vbulletin->userinfo[userid]);
	$lastcheck = intval($vbulletin->userinfo[lastrepcheck]);

	if ($vbulletin->options['duprep'])
	{ 
		if ($vbulletin->userinfo['showreputation'])
		{
			$data = $vbulletin->db->query_first_slave("
				SELECT COUNT(dateline) AS rcount 
				FROM ".TABLE_PREFIX."reputation 
				WHERE userid = $userid 
				AND dateline > $lastcheck
			");
		}

		$repcount = intval($data['rcount']);
		$vbulletin->userinfo['dup_repcount'] = $repcount;

		if ($repcount AND !$vbulletin->options['dupnote'])
		{
			if ($repcount == 1)
			{
				$rcount = construct_phrase($vbphrase['dup_reputation'],$repcount,$vbphrase['dup_single_comment'],$vbulletin->options['duppath']); 
			}
			else
			{
				$rcount = construct_phrase($vbphrase['dup_reputation'],$repcount,$vbphrase['dup_plural_comment'],$vbulletin->options['duppath']);  
			}		
			$vbphrase['last_visited_x_at_y'] .= '<br />'.$rcount;
		}		
	}
}
]]></phpcode>
		</plugin>
		<plugin active="1">
			<title>Unread Posts and Reputation (3)</title>
			<hookname>search_getnew_start</hookname>
			<phpcode><![CDATA[
if ($vbulletin->options['dupexcl'])
{
	$vbulletin->GPC['exclude'] .= ((!$vbulletin->GPC['exclude']) ? $vbulletin->options['dupexcl'] : ','.$vbulletin->options['dupexcl']);
}
]]></phpcode>
		</plugin>
		<plugin active="1" executionorder="5">
			<title>Unread Posts and Reputation (4)</title>
			<hookname>usercp_start</hookname>
			<phpcode><![CDATA[
$vbulletin->db->query_write("
	UPDATE " . TABLE_PREFIX . "user
	SET lastrepcheck = ".TIMENOW."
	WHERE userid = ".$vbulletin->userinfo['userid']."
");
]]></phpcode>
		</plugin>
	</plugins>
	<phrases>
		<phrasetype name="GLOBAL" fieldname="global">
			<phrase name="dup_new_reputation" date="1192000000" username="Paul M" version="3.7.002"><![CDATA[التقييمات الجديدة]]></phrase>
			<phrase name="dup_no_posts" date="1234000000" username="Paul M" version="3.8.002"><![CDATA[You Have <strong>No <a href="{1}search.php?do=getnew">Unread Posts</a></strong>]]></phrase>
			<phrase name="dup_no_posts_visit" date="1234000000" username="Paul M" version="3.8.002"><![CDATA[<strong>No <a href="{1}search.php?do=getnew">Unread Posts</a></strong> since your last visit.]]></phrase>
			<phrase name="dup_plural_comment" date="1192000000" username="Paul M" version="1.22"><![CDATA[comments]]></phrase>
			<phrase name="dup_plural_post" date="1156000000" username="Paul M" version="1.16"><![CDATA[Posts]]></phrase>
			<phrase name="dup_posts" date="1234000000" username="Paul M" version="3.8.002"><![CDATA[You Have <strong>{1} <a href="{3}search.php?do=getnew">Unread {2}</a></strong>]]></phrase>
			<phrase name="dup_posts_visit" date="1234000000" username="Paul M" version="3.8.002"><![CDATA[<strong>{1} <a href="{3}search.php?do=getnew">Unread {2}</a></strong> since your last visit.]]></phrase>
			<phrase name="dup_reputation" date="1192000000" username="Paul M" version="1.22"><![CDATA[You have <strong>{1} <a href="{3}usercp.php">New</a></strong> reputation {2}.]]></phrase>
			<phrase name="dup_single_comment" date="1192000000" username="Paul M" version="1.22"><![CDATA[comment]]></phrase>
			<phrase name="dup_single_post" date="1156000000" username="Paul M" version="1.16"><![CDATA[Post]]></phrase>
			<phrase name="dup_unread_posts" date="1208000000" username="Paul M" version="3.7.003"><![CDATA[Display <strong><a href="{1}search.php?do=getnew{2}">Unread Posts</a></strong>]]></phrase>
		</phrasetype>
		<phrasetype name="vBulletin Settings" fieldname="vbsettings">
			<phrase name="setting_dupexcl_desc" date="1208000000" username="Paul M" version="3.7.004"><![CDATA[افصل بفاصلة الاقسام المستثنية مواضيعها من الظهور في قائمة المشاركات الغير مقروءة.]]></phrase>
			<phrase name="setting_dupexcl_title" date="1208000000" username="Paul M" version="3.7.004"><![CDATA[قائمة الأقسام المستثنية]]></phrase>
			<phrase name="setting_duplimit_desc" date="1208000000" username="Paul M" version="3.7.003"><![CDATA[ضع الحد الأقصى للأيام التي ستحسب المشاركات فيها، إذا تجاوزت المشاركات هذا الحد سيظهر فقط رابط المشاركات غير المقروءة. هذه الخاصية ستحفظ الكثير من الضغط على القاعدة إذا الأعضاء ما زاروا المنتدى منذ مدة طويلة. ضعها صفر لتعطيل هذه الخاصية.]]></phrase>
			<phrase name="setting_duplimit_title" date="1208000000" username="Paul M" version="3.7.003"><![CDATA[الحد الأقصى للقطع]]></phrase>
			<phrase name="setting_dupnote_desc" date="1192000000" username="Paul M" version="3.7.002"><![CDATA[ضع على نعم  لعرض عدد تعليقات التقييم كإخطار أو ضعه على لا لعرضها فقط في النافبار.]]></phrase>
			<phrase name="setting_dupnote_title" date="1192000000" username="Paul M" version="3.7.002"><![CDATA[عرض تعليقات التقييم الجديدة]]></phrase>
			<phrase name="setting_duppath_desc" date="1192000000" username="Paul M" version="1.23"><![CDATA[مسار الصور التلقائي إذا كنت تستخدم أدفانس بورتال أو ما شابه قد تحتاج إلى تعديل المسار مثلاً إلى /pathtoforum/ - غير هذا لن تحتاج هذا الخيار فقط اتركه فارغ.]]></phrase>
			<phrase name="setting_duppath_title" date="1192000000" username="Paul M" version="1.23"><![CDATA[مسار الـ(Prefix)]]></phrase>
			<phrase name="setting_duppost_desc" date="1154000000" username="Paul M" version="1.21"><![CDATA[اختر خيار العرض أو عطل الهاك]]></phrase>
			<phrase name="setting_duppost_title" date="1154000000" username="Paul M" version="1.21"><![CDATA[خيار عرض المشاركات الغير مقروءة]]></phrase>
			<phrase name="setting_duprep_desc" date="1192000000" username="Paul M" version="1.22"><![CDATA[ضع (نعـم) لعرض عدد من تعليقات التقييمات الجديدة]]></phrase>
			<phrase name="setting_duprep_title" date="1192000000" username="Paul M" version="1.22"><![CDATA[عرض جديد تعليقات التقييمات]]></phrase>
			<phrase name="settinggroup_dupgroup" date="1152000000" username="Paul M" version="1.21"><![CDATA[هاك المشاركات وتعليقات التقييمات الغير المقروءة]]></phrase>
		</phrasetype>
	</phrases>
	<options>
		<settinggroup name="dupgroup" displayorder="3035">
			<setting varname="duppost" displayorder="10">
				<datatype>number</datatype>
				<optioncode>radio:piped
1|أستخدام تاريخ أخر زيارة
2|احسب كل المشاركات التي علمت على أنها غير مقروءة
0|تعطيل عرض المشاركات الغير مقروءه</optioncode>
				<defaultvalue>1</defaultvalue>
			</setting>
			<setting varname="duprep" displayorder="20">
				<datatype>boolean</datatype>
				<optioncode>yesno</optioncode>
				<defaultvalue>1</defaultvalue>
			</setting>
			<setting varname="duppath" displayorder="30">
				<datatype>free</datatype>
				<defaultvalue></defaultvalue>
			</setting>
			<setting varname="dupnote" displayorder="40">
				<datatype>boolean</datatype>
				<optioncode>yesno</optioncode>
				<defaultvalue>0</defaultvalue>
			</setting>
			<setting varname="duplimit" displayorder="50">
				<datatype>number</datatype>
				<defaultvalue>14</defaultvalue>
			</setting>
			<setting varname="dupexcl" displayorder="60">
				<datatype>free</datatype>
				<defaultvalue></defaultvalue>
			</setting>
		</settinggroup>
	</options>
	<helptopics>
	</helptopics>
	<cronentries>
	</cronentries>
	<faqentries>
	</faqentries>
</product>
