function birth_setSave($arr, $modId) { global $DMC, $DBPrefix; for ($i = 1; $i <= count($arr) / 3; $i++) { setPlugSet($modId, "birthTitle{$i}", $arr["birthTitle{$i}"]); setPlugSet($modId, "birthDate{$i}", $arr["birthDate{$i}"]); setPlugSet($modId, "textColor{$i}", $arr["textColor{$i}"]); } //Check file visit access $xmlFile = "../plugins/birth/birth.xml"; $os = strtoupper(substr(PHP_OS, 0, 3)); $fileAccess = intval(substr(sprintf('%o', fileperms($xmlFile)), -4)); if ($fileAccess < 777 and $os != "WIN") { $ActionMessage = "<b><font color='red'>birth.xml => Please change the CHMOD as 777.</font></b>"; } else { $filecontent = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; $filecontent .= "<birth>\n"; for ($i = 0; $i < count($arr) / 3; $i++) { $num = $i + 1; if ($arr["birthTitle{$num}"]) { $filecontent .= "\t<item>\n"; $filecontent .= "\t\t<birthTitle>" . $arr["birthTitle{$num}"] . "</birthTitle>\n"; $filecontent .= "\t\t<birthDate>" . $arr["birthDate{$num}"] . "</birthDate>\n"; $filecontent .= "\t\t<textColor>" . $arr["textColor{$num}"] . "</textColor>\n"; $filecontent .= "\t</item>\n"; } } $filecontent .= "</birth>\n"; $fp = fopen($xmlFile, "wb"); @fwrite($fp, $filecontent); @fclose($fp); $ActionMessage = ""; } return $ActionMessage; }
function nfo_setSave($arr, $modId) { global $DMC, $DBPrefix; $fieldList = array("bgcolor", "txtcolor", "imgtype"); for ($i = 0; $i < count($fieldList); $i++) { $name = $fieldList[$i]; setPlugSet($modId, $name, $arr[$name]); } //Check file visit access $configFile = "../plugins/nfo/nfo_config.php"; $os = strtoupper(substr(PHP_OS, 0, 3)); $fileAccess = intval(substr(sprintf('%o', fileperms($configFile)), -4)); if ($fileAccess < 777 and $os != "WIN") { $ActionMessage = "<b><font color='red'>nfo_config.php => Please change the CHMOD as 777.</font></b>"; } else { $fp = @fopen($configFile, 'r'); $filecontent = @fread($fp, @filesize($configFile)); @fclose($fp); $filecontent = preg_replace("/[\$]imgtype\\s*\\=\\s*[\"'].*?[\"']/is", "\$imgtype = \"" . $arr['imgtype'] . "\"", $filecontent); $filecontent = preg_replace("/[\$]bgcolor\\s*\\=\\s*[\"'].*?[\"']/is", "\$bgcolor = \"" . $arr['bgcolor'] . "\"", $filecontent); $filecontent = preg_replace("/[\$]txtcolor\\s*\\=\\s*[\"'].*?[\"']/is", "\$txtcolor = \"" . $arr['txtcolor'] . "\"", $filecontent); $fp = @fopen($configFile, 'wbt'); @fwrite($fp, trim($filecontent)); @fclose($fp); $ActionMessage = ""; } return $ActionMessage; }
function vote_setSave($arr, $modId) { global $DMC, $DBPrefix; $fieldList = array("voteWidth", "voteHeight", "voteTM"); $filecontent = ""; for ($i = 0; $i < count($fieldList); $i++) { $name = $fieldList[$i]; $filecontent .= "," . $arr[$name]; setPlugSet($modId, $name, $arr[$name]); } $filecontent = substr($filecontent, 1); //Check file visit access $configFile = "../plugins/vote/vote.txt"; $os = strtoupper(substr(PHP_OS, 0, 3)); $fileAccess = intval(substr(sprintf('%o', fileperms($configFile)), -4)); if ($fileAccess < 777 and $os != "WIN") { $ActionMessage = "<b><font color='red'>vote.txt => Please change the CHMOD as 777.</font></b>"; } else { $fp = @fopen($configFile, 'wbt'); @fwrite($fp, $filecontent); @fclose($fp); $ActionMessage = ""; } return $ActionMessage; }
function ccVideo_setSave($arr, $modId) { global $DMC, $DBPrefix; setPlugSet($modId, "ccuser", $arr["ccuser"]); setPlugSet($modId, "ccorder", $arr["ccorder"]); setPlugSet($modId, "ccstatus", $arr["ccstatus"]); }
function aboutMe_setSave($arr, $modId) { global $DMC, $DBPrefix; $sql = "delete from " . $DBPrefix . "modsetting where modId='{$modId}'"; $DMC->query($sql); for ($i = 0; $i < count($arr) / 2; $i++) { setPlugSet($modId, $arr["Field{$i}"], $arr["Value{$i}"]); } }
function smilies_setSave($arr, $modId) { global $DMC, $DBPrefix; $sql = "delete from " . $DBPrefix . "modsetting where modId='{$modId}'"; $DMC->query($sql); for ($i = 0; $i < count($arr); $i++) { setPlugSet($modId, $arr["Field{$i}"], $arr["Value{$i}"]); } //print_r($arr); return $ActionMessage; }
function flashLink_setSave($arr, $modId) { global $DMC, $DBPrefix; $fieldList = array("logo", "bgcolor", "txtcolor", "btbgcolor", "btOverbgcolor", "pagetextcolor"); for ($i = 0; $i < count($fieldList); $i++) { $name = $fieldList[$i]; setPlugSet($modId, $name, $arr[$name]); } //Check file visit access $xmlFile = "../plugins/flashLink/link.xml"; $os = strtoupper(substr(PHP_OS, 0, 3)); $fileAccess = intval(substr(sprintf('%o', fileperms($xmlFile)), -4)); if ($fileAccess < 777 and $os != "WIN") { $ActionMessage = "<b><font color='red'>Link.xml => Please change the CHMOD as 777.</font></b>"; } else { //Write XML $links = array(); $sql = "select * from " . $DBPrefix . "links where isSidebar=1 and isApp=1 order by orderNo"; $result = $DMC->query($sql); while ($fa = $DMC->fetchArray($result)) { $links[] = array('name' => $fa['name'], 'blogUrl' => $fa['blogUrl']); } $filecontent = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; $filecontent .= "<link"; for ($i = 0; $i < count($fieldList); $i++) { $name = $fieldList[$i]; $value = str_replace("#", "0x", $arr[$name]); $filecontent .= "\t{$name}=\"{$value}\""; } $filecontent .= ">\n"; foreach ($links as $link) { $filecontent .= " <item url=\"" . $link['blogUrl'] . "\">" . $link['name'] . "</item>\n"; } $filecontent .= "</link>\n"; $fp = fopen($xmlFile, "wb"); @fwrite($fp, $filecontent); @fclose($fp); $ActionMessage = ""; } return $ActionMessage; }
function MusicPlayer_setSave($arr, $modId) { global $DMC, $DBPrefix; for ($i = 0; $i < count($arr); $i++) { setPlugSet($modId, "title{$i}", $arr["title{$i}"]); setPlugSet($modId, "creator{$i}", $arr["creator{$i}"]); setPlugSet($modId, "location{$i}", $arr["location{$i}"]); } //Check file visit access $xmlFile = "../plugins/MusicPlayer/Playerlist.xml"; $os = strtoupper(substr(PHP_OS, 0, 3)); $fileAccess = intval(substr(sprintf('%o', fileperms($xmlFile)), -4)); if ($fileAccess < 777 and $os != "WIN") { $ActionMessage = "<b><font color='red'>playerlist.xml => Please change the CHMOD as 777.</font></b>"; } else { //Write XML $filecontent = "<playlist version=\"1\" xmlns=\"http://xspf.org/ns/0/\">\n"; $filecontent .= "<trackList>\n"; for ($i = 0; $i < count($arr); $i++) { $num = $i + 1; if ($arr["title{$num}"] != "") { $filecontent .= "\t<track>\n"; $filecontent .= "\t\t<title>" . $arr["title{$num}"] . "</title>\n"; $filecontent .= "\t\t<creator>" . $arr["creator{$num}"] . "</creator>\n"; $filecontent .= "\t\t<location>" . $arr["location{$num}"] . "</location>\n"; $filecontent .= "\t</track>\n"; } } $filecontent .= "</trackList>\n"; $filecontent .= "</playlist>\n"; $fp = fopen($xmlFile, "wb"); @fwrite($fp, $filecontent); @fclose($fp); $ActionMessage = ""; } return $ActionMessage; }
function SiteFocus_setSave($arr, $modId) { global $DMC, $DBPrefix; for ($i = 1; $i <= count($arr) / 3; $i++) { if (!empty($arr["imgtext{$i}"])) { setPlugSet($modId, "imgtext{$i}", $arr["imgtext{$i}"]); setPlugSet($modId, "imgurl{$i}", $arr["imgurl{$i}"]); setPlugSet($modId, "imglink{$i}", $arr["imglink{$i}"]); } } //Check file visit access $xmlFile = "../plugins/SiteFocus/site.xml"; $os = strtoupper(substr(PHP_OS, 0, 3)); $fileAccess = intval(substr(sprintf('%o', fileperms($xmlFile)), -4)); if ($fileAccess < 777 and $os != "WIN") { $ActionMessage = "<b><font color='red'>site.xml => Please change the CHMOD as 777.</font></b>"; } else { $filecontent = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; $filecontent .= "<sitefocus>\n"; for ($i = 1; $i <= count($arr) / 3; $i++) { if (!empty($arr["imgtext{$i}"])) { $filecontent .= "\t<item>\n"; $filecontent .= "\t\t<imgtext>" . $arr["imgtext{$i}"] . "</imgtext>\n"; $filecontent .= "\t\t<imgurl>" . $arr["imgurl{$i}"] . "</imgurl>\n"; $filecontent .= "\t\t<imglink>" . encode($arr["imglink{$i}"]) . "</imglink>\n"; $filecontent .= "\t</item>\n"; } } $filecontent .= "</sitefocus>\n"; $fp = fopen($xmlFile, "wb"); @fwrite($fp, $filecontent); @fclose($fp); $ActionMessage = ""; } return $ActionMessage; }
function MyIcon_setSave($arr, $modId) { global $DMC, $DBPrefix; setPlugSet($modId, "myIconsDefault", encode($arr["myIconsDefault"])); setPlugSet($modId, "myIconsSize", intval($arr["myIconsSize"])); }
function flashDaily_setSave($arr, $modId) { global $DMC, $DBPrefix; $fieldList = array("count_c", "bg_bg", "bg_line", "bc_kado", "bc_bg", "bc_line", "point", "point_txt", "v_grid", "d_txt", "point_line"); for ($i = 0; $i < count($fieldList); $i++) { $name = $fieldList[$i]; setPlugSet($modId, $name, $arr[$name]); //echo $name." ".$arr[$name]."<br />"; } //Check file visit access $xmlFile = "../plugins/flashDaily/color.xml"; $os = strtoupper(substr(PHP_OS, 0, 3)); $fileAccess = intval(substr(sprintf('%o', fileperms($xmlFile)), -4)); if ($fileAccess < 777 and $os != "WIN") { $ActionMessage = "<b><font color='red'>color.xml => Please change the CHMOD as 777.</font></b>"; } else { $filecontent = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; $filecontent .= "<color "; for ($i = 0; $i < count($fieldList); $i++) { $name = $fieldList[$i]; $value = str_replace("#", "0x", $arr[$name]); $filecontent .= "\t{$name}=\"{$value}\"\n"; } $filecontent .= "/>\n"; $fp = fopen($xmlFile, "wb"); @fwrite($fp, $filecontent); @fclose($fp); $ActionMessage = ""; } return $ActionMessage; }
function watermark_setSave($arr, $modId) { global $DMC, $DBPrefix; $fieldList = array("wm_position", "wm_image", "wm_text", "wm_font", "wm_color", "wm_transparence", "wm_width", "wm_height"); for ($i = 0; $i < count($fieldList); $i++) { $name = $fieldList[$i]; setPlugSet($modId, $name, $arr[$name]); } //Check file visit access $configFile = "../plugins/watermark/watermark_config.php"; $os = strtoupper(substr(PHP_OS, 0, 3)); $fileAccess = intval(substr(sprintf('%o', fileperms($configFile)), -4)); if ($fileAccess < 777 and $os != "WIN") { $ActionMessage = "<b><font color='red'>watermark_config.php => Please change the CHMOD as 777.</font></b>"; } else { //Write Config $fp = @fopen($configFile, 'r'); $filecontent = @fread($fp, @filesize($configFile)); @fclose($fp); $filecontent = preg_replace("/[\$]wm_width\\s*\\=\\s*[\"'].*?[\"']/is", "\$wm_width = \"" . $arr['wm_width'] . "\"", $filecontent); $filecontent = preg_replace("/[\$]wm_height\\s*\\=\\s*[\"'].*?[\"']/is", "\$wm_height = \"" . $arr['wm_height'] . "\"", $filecontent); $filecontent = preg_replace("/[\$]wm_position\\s*\\=\\s*[\"'].*?[\"']/is", "\$wm_position = \"" . $arr['wm_position'] . "\"", $filecontent); $filecontent = preg_replace("/[\$]wm_image\\s*\\=\\s*[\"'].*?[\"']/is", "\$wm_image = \"" . $arr['wm_image'] . "\"", $filecontent); $filecontent = preg_replace("/[\$]wm_text\\s*\\=\\s*[\"'].*?[\"']/is", "\$wm_text = \"" . $arr['wm_text'] . "\"", $filecontent); $filecontent = preg_replace("/[\$]wm_font\\s*\\=\\s*[\"'].*?[\"']/is", "\$wm_font = \"" . $arr['wm_font'] . "\"", $filecontent); $filecontent = preg_replace("/[\$]wm_color\\s*\\=\\s*[\"'].*?[\"']/is", "\$wm_color = \"" . $arr['wm_color'] . "\"", $filecontent); $filecontent = preg_replace("/[\$]wm_transparence\\s*\\=\\s*[\"'].*?[\"']/is", "\$wm_transparence = \"" . $arr['wm_transparence'] . "\"", $filecontent); $fp = @fopen($configFile, 'w'); @fwrite($fp, trim($filecontent)); @fclose($fp); $ActionMessage = ""; } return $ActionMessage; }
function install_plugins($arr) { global $DMC, $DBPrefix, $strDataExists; $category = isset($arr['Type']) ? encode(trim($arr['Type'])) : ""; $name = isset($arr['Desc']) ? encode(trim($arr['Desc'])) : ""; $plugin = isset($arr['Name']) ? encode(trim($arr['Name'])) : ""; $htmlcode = isset($arr['Code']) ? encode(trim($arr['Code'])) : ""; $pluginpath = isset($arr['Path']) ? encode(trim($arr['Path'])) : ""; $indexOnly = isset($arr['indexOnly']) ? trim($arr['indexOnly']) : 0; $isInstall = isset($arr['isInstall']) ? trim($arr['isInstall']) : 0; $DefaultField = isset($arr['DefaultField']) ? $arr['DefaultField'] : ""; $DefaultValue = isset($arr['DefaultValue']) ? $arr['DefaultValue'] : ""; switch ($category) { case "Top": $disType = "1"; break; case "Side": $disType = "2"; break; case "Main": $disType = "3"; break; case "Func": $disType = "88"; break; } $rsexits = getFieldValue($DBPrefix . "modules", "name='" . encode($plugin) . "' and disType='{$disType}'", "id"); if ($rsexits != "") { $ActionMessage = "{$strDataExists}"; } else { $orderno = getFieldValue($DBPrefix . "modules", "disType='{$disType}' order by orderNo desc", "orderNo"); if ($orderno < 1) { $orderno = 1; } else { $orderno++; } $postTime = time(); $sql = "INSERT INTO " . $DBPrefix . "modules(name,modTitle,disType,htmlCode,pluginPath,orderNo,installDate,isInstall,indexOnly,isHidden) VALUES ('{$plugin}','{$name}','{$disType}','{$htmlcode}','{$pluginpath}','{$orderno}','{$postTime}','{$isInstall}','{$indexOnly}','0')"; $DMC->query($sql); $error = $DMC->error(); if ($error == "") { //Set Default value $modId = $DMC->insertId(); if (is_array($DefaultField)) { for ($i = 0, $max = count($DefaultField); $i < $max; $i++) { setPlugSet($modId, encode($DefaultField[$i]), encode($DefaultValue[$i])); } } $ActionMessage = ""; } else { $ActionMessage = $error; } } return $ActionMessage; }
function f2bababian_setSave($arr, $modId) { global $DMC, $DBPrefix; /*$sql="delete from ".$DBPrefix."modsetting where modId='$modId'"; $DMC->query($sql); for($i=0;$i<count($arr);$i++) { setPlugSet($modId,$arr["Field$i"],$arr["Value$i"]); }*/ $ActionMessage = ""; //注册用户 if ($arr['bbb_step'] == "login") { include '../plugins/f2bababian/BabaBian.php'; $GoBind = new BabaBian(); $bbb_email = $arr['bbb_email']; $bbb_password = $arr['bbb_password']; $bbb_api_key = $arr['bbb_api_key']; $GoBind->api_key = $bbb_api_key; if ($bbb_email != "" && $bbb_password != "" && $bbb_api_key != "") { //echo $bbb_email."===".$bbb_password."===".$bbb_api_key; if ($GoBind->userbind($bbb_email, $bbb_password)) { list($bbb_user_key, $bbb_user_id) = $GoBind->user_key_id; //echo "User Key:".$user_key."+++ $userID <br />"; setPlugSet($modId, "bbb_email", $bbb_email); setPlugSet($modId, "bbb_api_key", $bbb_api_key); setPlugSet($modId, "bbb_user_key", $bbb_user_key); setPlugSet($modId, "bbb_user_id", $bbb_user_id); } else { $ActionMessage .= $GoBind->fault[0] . "(" . $GoBind->fault[1] . ")<br />"; //显示错误相关信息 } } else { $ActionMessage = "请输入完整巴巴账号,密码与api key。"; } } //保存参数 if ($arr['bbb_step'] == "setting") { $bbb_per_row = $arr['bbb_per_row']; $bbb_per_page = $arr['bbb_per_page']; $bbb_size = $arr['bbb_size']; $bbb_showimage = $arr['bbb_showimage']; if ($bbb_per_row != "" && $bbb_per_page != "" && $bbb_size != "" && $bbb_showimage != "") { $check_info = true; if ($bbb_per_row < 1 || $bbb_per_row > 10) { $ActionMessage = "你输入的每行显示数不正确,必须为1~10。"; $check_info = false; } if (($bbb_per_page < 10 || $bbb_per_row > 20) && $check_info == true) { $ActionMessage = "你输入的每页显示数不正确,必须为10~20。"; $check_info = false; } if ($check_info == true) { //echo $bbb_per_row."===".$bbb_per_page."===".$bbb_size."===".$bbb_showimage; setPlugSet($modId, "bbb_per_row", $bbb_per_row); setPlugSet($modId, "bbb_per_page", $bbb_per_page); setPlugSet($modId, "bbb_size", $bbb_size); setPlugSet($modId, "bbb_showimage", $bbb_showimage); } } else { $ActionMessage = "你输入的设定值不正确!"; } } //print_r($arr); return $ActionMessage; }
function createlogs_setSave($arr, $modId) { global $DMC, $DBPrefix; setPlugSet($modId, "createdate", $arr["createdate"]); }
function Delicious_setSave($arr, $modId) { global $DMC, $DBPrefix; setPlugSet($modId, "user", $arr["f_user"]); }