diff --git a/public/common.js b/public/common.js
index e8ba65d4..66baa26d 100644
--- a/public/common.js
+++ b/public/common.js
@@ -91,6 +91,26 @@ function unpreview(obj){
document.getElementById("previewbutton").style.display = 'block';
}
+function saveMagicValue(torrentid,value)
+{
+ var list=ajax.posts('magic.php','value='+value +'&id='+torrentid);
+// document.getElementById("thanksbutton").innerHTML = document.getElementById("thanksadded").innerHTML;
+ document.getElementById("magic_add").value += value;
+ document.getElementById("magic_add").style.display = '';
+ document.getElementById("listNumber").style.display = 'none';
+ document.getElementById("current_user_magic").style.display = '';
+ var sumAll = document.getElementById("spanSumAll").innerHTML;
+ document.getElementById("spanSumAll").innerHTML = sumAll*1 + value;
+ if(document.getElementById("count_user_spa")){
+ var userAll = document.getElementById("count_user_spa").innerHTML;
+ document.getElementById("count_user_spa").innerHTML = userAll*1 + 1;
+ }
+
+ //document.getElementById("listNumber").innerHTML = "";
+
+// document.getElementById("addcuruser").innerHTML = document.getElementById("curuser").innerHTML;
+}
+
// java_klappe.js
function klappe(id)
@@ -383,4 +403,4 @@ function NewRow(anchor,up){
}
function DelRow(anchor){
anchor.parentNode.parentNode.parentNode.parentNode.deleteRow(anchor.parentNode.parentNode.rowIndex);
-}
\ No newline at end of file
+}
diff --git a/public/details.php b/public/details.php
index f90c7471..408fd168 100644
--- a/public/details.php
+++ b/public/details.php
@@ -403,6 +403,132 @@ echo $scronload;
echo "";
}
+ //Add 魔力值奖励功能
+ if(isset($magic_value_bonus)){
+ $bonus_array = $magic_value_bonus;
+ }else{
+ $bonus_array = '50 , 100 , 200 , 500, 1000';
+ }
+ echo '
+ ';
+ $magic_value_button = '';
+
+ if ($CURUSER['id'] <> $row['owner']) {
+ $arr_temp = explode(',',$bonus_array);
+ $bonus_has = $CURUSER['seedbonus'];
+ if(intval($bonus_has) < intval($arr_temp[0])){
+ $error_bonus_message = $lang_details['magic_have_no_enough_bonus_value'];
+ $button_name = "";
+ $magic_value_button .= $button_name;
+ }else{
+ foreach($arr_temp as $key => $each_temp){
+ $each_temp = intval($each_temp);
+ if ($each_temp > 0 && $each_temp <= $bonus_has) {
+ $button_name = $magic_value_button.$key;
+ $magic_button_id = 'magic_value_'.$key;
+ $each_temp_font = ''.('+'.$each_temp).'';
+ $error_bonus_message = $lang_details['magic_have_no_enough_bonus_value'];
+ $button_name = "
".$each_temp_font."";
+
+ $magic_value_button .= $button_name;
+ }
+ }
+ }
+ }
+
+ $span_description = $lang_details['span_description_have_given'];
+ $span = ' ';
+ $whether_have_give_value = 0;
+ $give_value = array();
+ $no_give = "";
+ $add_value ="";
+
+ $tempresult = sql_query ("SELECT count( DISTINCT `userid` ) as count FROM magic WHERE torrentid=".sqlesc($id));
+ $count_user = mysql_fetch_array($tempresult);
+ $count_user_number = $count_user['count'];
+
+ $give_value_sql = sql_query("SELECT userid,value FROM magic WHERE torrentid=".sqlesc($id)." ORDER BY id DESC");
+
+ $give_value_count = get_row_count("magic", "WHERE torrentid=".sqlesc($id));
+ $give_value_all = mysql_num_rows($give_value_sql);
+ $sum_value = 0;
+ if ($give_value_all) {
+ while($rows_t = mysql_fetch_array($give_value_sql)) {
+ $give_value_userid = $rows_t["userid"];
+ $sum_value += $rows_t["value"]*1;
+ if ($give_value_userid == $CURUSER['id']) {
+ $whether_have_give_value = 1;
+ $add_value = $rows_t["value"];
+ }
+ $give_value[] = get_username($give_value_userid)." ";
+ }
+ }else $no_give = $lang_details['text_no_magic_added'];
+
+ if(intval($bonus_has) < intval($arr_temp[0])){
+
+ }else if ($whether_have_give_value == 0 ) {
+ $magic_value_button = '';
+ } else {
+ $add_value = str_replace("Number",$add_value,$lang_details['magic_value_number']);
+ $magic_value_button ="";
+ //$give_value = get_username($CURUSER['id'])." ".$give_value;
+ }
+
+ $show_list = null;
+ $show_all = null;
+ $show_list_new_number = 6;
+ $other_user_str = null;
+ $other_user_span = null;
+ if(count($give_value) > 0){
+ $count_user_span = ''.$count_user_number.'';
+ $magic_newest_record = ''. $lang_details['magic_newest_record'].'';
+ $show_list_description ='('. $magic_newest_record.$lang_details['magic_sum_user_give_number'].')';
+ $show_list_description = str_replace('Number',$count_user_span,$show_list_description);
+ $output = array_slice($give_value, 0, $show_list_new_number);
+ foreach($output as $eachOutput){
+ $show_list .= $eachOutput.' ';
+ }
+ //other user list
+ if(count($give_value) > $show_list_new_number){
+ $show_list .= ' ...... ';
+ $show_all_description = '['.$lang_details['magic_show_all_description'].']';
+ $show_all = ''.$show_all_description.''.'
';
+ $other_user_list = array_slice($give_value, $show_list_new_number, count($give_value));
+ foreach($other_user_list as $each){
+ $other_user_str .= $each.' ';
+ }
+ $other_user_span = ''.$other_user_str.'';
+ }
+ }else{
+ $show_list_description = null;
+ $haveGotBonus = $no_give;
+ }
+ $current_user_magic = "".get_username($CURUSER['id'])." ";
+ $haveGotBonus = $lang_details['magic_haveGotBonus'].' ';
+ $spanSumAll = ''.$sum_value.'';
+ $haveGotBonus = str_replace('Number',$spanSumAll,$haveGotBonus);
+ $firstLine = ''.$magic_value_button.$span.$haveGotBonus.$show_all.'
';
+ $otherLine = ''.$current_user_magic.$show_list.$other_user_span.$show_list_description.'
';
+ tr($lang_details['magic_value_award'],$firstLine.$otherLine,1);
+ //End 魔力值奖励功能
+
// ------------- start thanked-by block--------------//
$torrentid = $id;
diff --git a/public/magic.php b/public/magic.php
new file mode 100644
index 00000000..6933aee3
--- /dev/null
+++ b/public/magic.php
@@ -0,0 +1,29 @@
+ $CURUSER['seedbonus']) stderr('Error','You do not have such bonus!');
+$tsql = sql_query("SELECT owner FROM torrents WHERE id = $torrentid") or sqlerr(__FILE__,__LINE__);
+$arr = mysql_fetch_assoc($tsql);
+if (!$arr) stderr("Error", "Invalid torrent id!");
+
+$torrentowner = $arr['owner'];
+if($torrentowner == $userid) stderr('Error', 'You are giving magic to yourself.');
+$tsql = sql_query("SELECT COUNT(*) FROM magic WHERE torrentid=$torrentid and userid=$userid") or sqlerr(__FILE__,__LINE__);
+$trows = mysql_fetch_assoc($tsql);
+$t_ab = $trows[0];
+if ($t_ab != 0) stderr("Error", "You already gave the magic value!");
+
+if (isset($userid) && isset($torrentid)&& isset($value)) {
+ sql_query("INSERT INTO magic (torrentid, userid,value) VALUES ($torrentid, $userid, $value)") or sqlerr(__FILE__,__LINE__);
+ KPS("-",$value,$CURUSER['id']);//selete
+ KPS("+",$value,$torrentowner);//add to the owner
+}
diff --git a/public/styles/boli.png b/public/styles/boli.png
new file mode 100644
index 00000000..4f88a1a1
Binary files /dev/null and b/public/styles/boli.png differ
diff --git a/public/styles/huise.png b/public/styles/huise.png
new file mode 100644
index 00000000..e2af6def
Binary files /dev/null and b/public/styles/huise.png differ