/** * 数据库缓存到本地文件 * @return unknown */ public function file() { $arrCache = $this->findAll('cache'); foreach ($arrCache as $key => $item) { fileWrite($item['cachename'] . '.php', 'data', $this->get($item['cachename'])); } }
public function optionsdo() { //先清空数据 $this->doSql("TRUNCATE TABLE `" . dbprefix . "weibo_options`"); foreach ($_POST['option'] as $key => $item) { $optionname = $key; $optionvalue = trim($item); $this->create('weibo_options', array('optionname' => $optionname, 'optionvalue' => $optionvalue)); } $arrOptions = $this->findAll('weibo_options', null, null, 'optionname,optionvalue'); foreach ($arrOptions as $item) { $arrOption[$item['optionname']] = $item['optionvalue']; } fileWrite('weibo_options.php', 'data', $arrOption); $GLOBALS['tsMySqlCache']->set('weibo_options', $arrOption); qiMsg('修改成功!'); }
function __autoload($class_name) { $file = ROOT_PATH . 'include/table/' . $class_name . '.class.php'; if (!file_exists($file)) { $file = ROOT_PATH . 'include/class/' . $class_name . '.class.php'; if (!file_exists($file)) { $file = ROOT_PATH . 'include/class/' . $class_name . '/' . $class_name . '.class.php'; if (!file_exists($file)) { $str = file_get_contents(ROOT_PATH . 'include/template.php'); $str = str_replace('CLASSNAME', $class_name, $str); fileWrite(ROOT_PATH . 'cache/', 'tmpclass.php', $str); $file = ROOT_PATH . 'cache/' . 'tmpclass.php'; } } } include_once $file; }
<?php defined('IN_TS') or die('Access Denied.'); switch ($ts) { //基本配置 case "": $arrOptions = $new['redeem']->findAll('redeem_options'); foreach ($arrOptions as $item) { $strOption[$item['optionname']] = stripslashes($item['optionvalue']); } include template("admin/options"); break; case "do": //先清空数据 $db->query("TRUNCATE TABLE `" . dbprefix . "redeem_options`"); foreach ($_POST['option'] as $key => $item) { $optionname = $key; $optionvalue = trim($item); $new['redeem']->create('redeem_options', array('optionname' => $optionname, 'optionvalue' => $optionvalue)); } $arrOptions = $new['redeem']->findAll('redeem_options', null, null, 'optionname,optionvalue'); foreach ($arrOptions as $item) { $arrOption[$item['optionname']] = $item['optionvalue']; } fileWrite('redeem_options.php', 'data', $arrOption); $tsMySqlCache->set('redeem_options', $arrOption); qiMsg('修改成功!'); break; }
defined('IN_TS') or die('Access Denied.'); switch ($ts) { //角色列表 case "list": $arrRole = $new['user']->findAll('user_role'); include template('admin/role_list'); break; //角色修改 //角色修改 case "do": $arrRoleName = $_POST['rolename']; $arrScoreStart = $_POST['score_start']; $arrScoreEnd = $_POST['score_end']; //先清空 $db->query("TRUNCATE TABLE `" . dbprefix . "user_role`"); //后添加 foreach ($arrRoleName as $key => $item) { $rolename = trim($item); $score_start = trim($arrScoreStart[$key]); $score_end = trim($arrScoreEnd[$key]); if ($rolename) { $new['user']->create('user_role', array('rolename' => $rolename, 'score_start' => $score_start, 'score_end' => $score_end)); } } //再生成缓存文件 $arrRole = $new['user']->findAll('user_role', null, null, 'rolename,score_start,score_end'); fileWrite('user_role.php', 'data', $arrRole); $tsMySqlCache->set('user_role', $arrRole); qiMsg("修改成功!"); break; }
$new['group']->create('group_user', array('userid' => $iuserid, 'groupid' => $groupid, 'addtime' => time())); //计算小组会员数 $count_user = $new['group']->findCount('group_user', array('groupid' => $groupid)); //更新小组成员统计 $new['group']->update('group', array('groupid' => $groupid), array('count_user' => $count_user)); //发送系统消息开始 $msg_userid = '0'; $msg_touserid = $iuserid; $msg_content = '你被邀请加入一个小组,快去看看吧<br />' . tsUrl('group', 'show', array('id' => $groupid)); aac('message')->sendmsg($msg_userid, $msg_touserid, $msg_content); //发送系统消息end header('Location: ' . tsUrl('group', 'show', array('id' => $groupid))); } else { tsNotice('倒霉了吧?'); } break; //usertips //usertips case "usertips": $data = fileRead('data/user_tips.php'); if ($data == '') { $query = $db->fetch_all_assoc("select * from " . dbprefix . "user_info"); foreach ($query as $user) { $usertip[] = array('user' => $user['username'], 'name' => $user['userid']); } fileWrite('user_tips.php', 'data', json_encode($usertip)); $data = fileRead('data/user_tips.php'); } echo $data; break; }
/** * Writes the data to the config files * * @author Chris Smith <*****@*****.**> */ function store_data($d) { global $LC; $ok = true; $d['policy'] = (int) $d['policy']; // create local.php $now = gmdate('r'); $output = <<<EOT <?php /** * Dokuwiki's Main Configuration File - Local Settings * Auto-generated by install script * Date: {$now} */ EOT; $output .= '$conf[\'title\'] = \'' . addslashes($d['title']) . "';\n"; $output .= '$conf[\'lang\'] = \'' . addslashes($LC) . "';\n"; $output .= '$conf[\'license\'] = \'' . addslashes($d['license']) . "';\n"; if ($d['acl']) { $output .= '$conf[\'useacl\'] = 1' . ";\n"; $output .= "\$conf['superuser'] = '******';\n"; } $ok = $ok && fileWrite(DOKU_LOCAL . 'local.php', $output); if ($d['acl']) { // hash the password $phash = new PassHash(); $pass = $phash->hash_smd5($d['password']); // create users.auth.php // --- user:SMD5password:Real Name:email:groups,comma,seperated $output = join(":", array($d['superuser'], $pass, $d['fullname'], $d['email'], 'admin,user')); $output = @file_get_contents(DOKU_CONF . 'users.auth.php.dist') . "\n{$output}\n"; $ok = $ok && fileWrite(DOKU_LOCAL . 'users.auth.php', $output); // create acl.auth.php $output = <<<EOT # acl.auth.php # <?php exit()?> # Don't modify the lines above # # Access Control Lists # # Auto-generated by install script # Date: {$now} EOT; if ($d['policy'] == 2) { $output .= "* @ALL 0\n"; $output .= "* @user 8\n"; } elseif ($d['policy'] == 1) { $output .= "* @ALL 1\n"; $output .= "* @user 8\n"; } else { $output .= "* @ALL 8\n"; } $ok = $ok && fileWrite(DOKU_LOCAL . 'acl.auth.php', $output); } return $ok; }
<?php defined('IN_TS') or die('Access Denied.'); //插件编辑 switch ($ts) { //编辑 case "set": $arrData = fileRead('data/plugins_pubs_wordad.php'); if ($arrData == '') { $arrData = $tsMySqlCache->get('plugins_pubs_wordad'); } include 'edit.html'; break; //执行编辑 //执行编辑 case "do": $arrTitle = $_POST['title']; $arrUrl = $_POST['url']; foreach ($arrTitle as $key => $item) { $title = trim($item); $url = trim($arrUrl[$key]); if ($title && $url) { $arrData[] = array('title' => $title, 'url' => $url); } } fileWrite('plugins_pubs_wordad.php', 'data', $arrData); $tsMySqlCache->set('plugins_pubs_wordad', $arrData); header('Location: ' . SITE_URL . 'index.php?app=pubs&ac=plugin&plugin=wordad&in=edit&ts=set'); break; }
$smarty->caching = false; $smarty->cache_lifetime = $CONFIG['SMARTY_CACHE_LIFETIME']; $smarty->template_dir = '../tpl'; $smarty->compile_dir = '../cache/tpl_c'; $smarty->cache_dir = '../cache/html'; $smarty->assign('PHPDL_INSTALLED', mktime()); $smarty->assign('DB_HOST', $DB_HOST); $smarty->assign('DB_NAME', $DB_NAME); $smarty->assign('DB_USER', $DB_USER); $smarty->assign('DB_PASS', $DB_PASS); $smarty->assign('WGET', $WGET); $smarty->assign('PS', $PS); $smarty->assign('USER_PASSWORD_SALT', $USER_PASSWORD_SALT); $smarty->assign('USER_SESSION_TTL', $USER_SESSION_TTL); if (fileWrite($CONFIG_PATH, $smarty->fetch($CONFIG_TPL_PATH))) { if (fileWrite('INSTALLED', date('Y-m-d H:i:s'))) { htmlInstallFinished(); } } else { print '<b><font color="#cc0000">Installation failed</font></b>'; } } else { print '<b><font color="#cc0000">Installation failed. No Smarty available!</font></b>'; } htmlFooter(); break; case 'mysqlCheckConnection': $_SESSION['DB_HOST'] = $_GET['DB_HOST']; $_SESSION['DB_NAME'] = $_GET['DB_NAME']; $_SESSION['DB_USER'] = $_GET['DB_USER']; $_SESSION['DB_PASS'] = $_GET['DB_PASS'];
<?php defined('IN_TS') or die('Access Denied.'); switch ($ts) { //配置 case "": $arrOptions = $new['user']->findAll('user_options'); foreach ($arrOptions as $item) { $strOption[$item['optionname']] = $item['optionvalue']; } include template("admin/options"); break; //配置执行 //配置执行 case "do": //先清空数据 $db->query("TRUNCATE TABLE `" . dbprefix . "user_options`"); foreach ($_POST['option'] as $key => $item) { $optionname = $key; $optionvalue = trim($item); $new['user']->create('user_options', array('optionname' => $optionname, 'optionvalue' => $optionvalue)); } $arrOptions = $new['user']->findAll('user_options', null, null, 'optionname,optionvalue'); foreach ($arrOptions as $item) { $arrOption[$item['optionname']] = $item['optionvalue']; } fileWrite('user_options.php', 'data', $arrOption); $tsMySqlCache->set('user_options', $arrOption); qiMsg("用户APP配置成功!"); break; }
//生成缓存 $arrIps = $new['system']->findAll('anti_ip'); foreach ($arrIps as $key => $item) { $arrIp[] = $item['ip']; } fileWrite('system_anti_ip.php', 'data', $arrIp); $tsMySqlCache->set('system_anti_ip', $arrIp); } qiMsg('垃圾IP添加成功!'); } else { qiMsg('垃圾IP不能为空!'); } break; case "ipdel": $id = intval($_GET['id']); $new['system']->delete('anti_ip', array('id' => $id)); //生成缓存 $arrIps = $new['system']->findAll('anti_ip'); foreach ($arrIps as $key => $item) { $arrIp[] = $item['ip']; } fileWrite('system_anti_ip.php', 'data', $arrIp); $tsMySqlCache->set('system_anti_ip', $arrIp); qiMsg('删除成功!'); break; //云词 //云词 case "cloud": include template('anti_cloud'); break; }
<?php defined('IN_TS') or die('Access Denied.'); //插件编辑 switch ($ts) { case "set": $arrNav = fileRead('data/plugins_pubs_navs.php'); if ($arrNav == '') { $arrNav = $tsMySqlCache->get('plugins_pubs_navs'); } include 'edit_set.html'; break; case "do": $arrNavName = $_POST['navname']; $arrNavUrl = $_POST['navurl']; foreach ($arrNavName as $key => $item) { $navname = trim($item); $navurl = trim($arrNavUrl[$key]); if ($navname && $navurl) { $arrNav[] = array('navname' => $navname, 'navurl' => $navurl); } } fileWrite('plugins_pubs_navs.php', 'data', $arrNav); $tsMySqlCache->set('plugins_pubs_navs', $arrNav); header('Location: ' . SITE_URL . 'index.php?app=pubs&ac=plugin&plugin=navs&in=edit&ts=set'); break; }
function main() { global $CONFIG, $SCHEDULER_LAST; print "\n"; printd("start\n"); printd("cwd: " . getcwd() . "\n"); $date = date('Ymd'); fileWrite($CONFIG['PHPDL_STACK_PIDFILE'], posix_getpid()); $n = 0; while (!$SHUTDOWN) { $n++; $dbh = dbConnect(); $scheduler = scheduler($dbh); $filesDownloading = filesDownloading($dbh); if ($SCHEDULER_LAST != $scheduler) { plog("scheduler '{$scheduler}' matched\n"); $SCHEDULER_LAST = $scheduler; } $res = mysql_query("select id from packets where archive = '0' and active = '1' and ftime = '0' order by sortnr, id;", $dbh); if (mysql_num_rows($res)) { while ($row = mysql_fetch_assoc($res)) { $packet = new dlpacket($CONFIG['DB_HOST'], $CONFIG['DB_NAME'], $CONFIG['DB_USER'], $CONFIG['DB_PASS']); if ($packet->loadById($row['id'])) { $packetDirBn = getPacketFilename($packet->get('id'), $packet->get('name')); $packetDownloadDir = 'downloads/loading/' . $packetDirBn; $packetFinishedDir = 'downloads/finished/' . $packetDirBn; if ($packet->loadFiles()) { if ($packet->filesUnfinished()) { if ($scheduler > 0) { if ($filesDownloading < $CONFIG['DL_SLOTS']) { if (!$packet->get('stime')) { $packet->save('stime', mktime()); } if ($nextfile = $packet->getFileNextUnfinished()) { while ($nextfile->get('error')) { printd("nextfile " . $nextfile->get('id') . "\n"); $nextfile = $packet->getFileNextUnfinished(); if (!$nextfile) { break; } sleep(1); } if ($nextfile) { printd("packet " . $packet->get('id') . ": download " . $nextfile->get('id') . "\n"); $sh = 'php wget.php ' . $nextfile->get('id') . ' 1>> log/wget.' . $date . '.log 2>> log/wget.' . $date . '.log &'; printd("exec '{$sh}'\n"); system($sh); sleep(1); break; } } } else { plog("no free download slots (" . $CONFIG['DL_SLOTS'] . ")\n"); } } } else { printd("packet " . $packet->get('id') . ": all files finished\n"); if (!$packet->get('stime')) { $packet->set('stime', mktime()); } $packet->save('ftime', mktime()); $packet->md5Verify(); $packet->sizeVerify(); if (!$packet->fileErrors()) { if (file_exists($packetFinishedDir)) { $files = scandir($packetDownloadDir); foreach ($files as $file) { if ($file != '.' && $file != '..' && file_exists($packetDownloadDir . '/' . $file)) { rename($packetDownloadDir . '/' . $file, $packetFinishedDir . '/' . $file); } } reset($files); rmdir($packetDownloadDir); } else { rename($packetDownloadDir, $packetFinishedDir); } } } } } unset($packet); } } else { plog("no active download\n"); } dbClose($dbh); $SHUTDOWN = shutdownCheck(); sleep(5); } shutdown(); }
qiMsg("插件停用成功!"); } elseif ($isused == '1') { array_push($app_plugins, $pname); if (file_exists('plugins/' . $apps . '/' . $pname . '/install.sql')) { $sql = file_get_contents('plugins/' . $apps . '/' . $pname . '/install.sql'); $sql = str_replace('ts_', '' . dbprefix . '', $sql); $ret = $db->query($sql); if ($ret == '1') { fileWrite($apps . '_plugins.php', 'data', $app_plugins); $tsMySqlCache->set($apps . '_plugins', $app_plugins); $msg = '插件启用成功!'; } else { $msg = $ret; } } else { fileWrite($apps . '_plugins.php', 'data', $app_plugins); $tsMySqlCache->set($apps . '_plugins', $app_plugins); $msg = '插件启用成功!'; } qiMsg($msg); } break; //删除插件 //删除插件 case "delete": $apps = tsUrlCheck($_GET['apps']); $pname = tsUrlCheck($_GET['pname']); delDir('plugins/' . $apps . '/' . $pname); qiMsg('删除成功!'); break; }
*/ //导航 case "appnav": $appkey = $_POST['appkey']; $appname = $_POST['appname']; $arrNav = (include 'data/system_appnav.php'); if (is_array($arrNav)) { $arrNav[$appkey] = $appname; } else { $arrNav = array($appkey => $appname); } foreach ($arrNav as $key => $item) { if (!is_dir('app/' . $key)) { unset($arrNav[$key]); } } fileWrite('system_appnav.php', 'data', $arrNav); $tsMySqlCache->set('system_appnav', $arrNav); echo '1'; break; //取消导航 //取消导航 case "unappnav": $appkey = $_POST['appkey']; $arrNav = (include 'data/system_appnav.php'); unset($arrNav[$appkey]); fileWrite('system_appnav.php', 'data', $arrNav); $tsMySqlCache->set('system_appnav', $arrNav); echo '1'; break; }
<?php defined('IN_TS') or die('Access Denied.'); //插件编辑 switch ($ts) { case "set": $arrData = fileRead('data/plugins_pubs_douban.php'); if ($arrData == '') { $arrData = $tsMySqlCache->get('plugins_pubs_douban'); } include 'html/edit.html'; break; case "do": $key = trim($_POST['key']); $secret = trim($_POST['secret']); $siteurl = $_POST['siteurl']; $arrData = array('key' => $key, 'secret' => $secret, 'siteurl' => $siteurl); fileWrite('plugins_pubs_douban.php', 'data', $arrData); $tsMySqlCache->set('plugins_pubs_douban', $arrData); header('Location: ' . SITE_URL . 'index.php?app=pubs&ac=plugin&plugin=douban&in=edit&ts=set'); break; }
<?php defined('IN_TS') or die('Access Denied.'); switch ($ts) { //基本配置 case "": $arrOptions = $new['group']->findAll('group_options'); foreach ($arrOptions as $item) { $strOption[$item['optionname']] = stripslashes($item['optionvalue']); } include template("admin/options"); break; case "do": //先清空数据 $db->query("TRUNCATE TABLE `" . dbprefix . "group_options`"); foreach ($_POST['option'] as $key => $item) { $optionname = $key; $optionvalue = trim($item); $new['group']->create('group_options', array('optionname' => $optionname, 'optionvalue' => $optionvalue)); } $arrOptions = $new['group']->findAll('group_options', null, null, 'optionname,optionvalue'); foreach ($arrOptions as $item) { $arrOption[$item['optionname']] = $item['optionvalue']; } fileWrite('group_options.php', 'data', $arrOption); $tsMySqlCache->set('group_options', $arrOption); qiMsg('修改成功!'); break; }
require_once 'file.php'; $usern = $_SESSION['login_user']; $conn1 = $_SESSION['conn']; $quer = $_POST['stext']; $propic = mysqli_query($conn1, "select picture from user where id = (select id from login where username='******')"); $row1 = mysqli_fetch_assoc($propic); $serres = ""; if ($_POST["search"] && isset($_POST['sbutton'])) { $serres = $_POST["search"]; fileWrite("---t---", $serres); if ($serres == "t") { $tags = mysqli_query($conn1, "SELECT * FROM pics WHERE photoid IN (SELECT picid FROM pictags WHERE tagid in (SELECT tagid FROM tags WHERE tagname LIKE '%" . $quer . "%'))"); fileWrite("---t---", "inside"); } elseif ($serres == "u") { $tags = mysqli_query($conn1, "SELECT * FROM user WHERE firstname LIKE '%" . $quer . "%' OR lastname LIKE '%" . $quer . "%'"); fileWrite("---u---", "inside"); } } ?> <!DOCTYPE html> <html> <head> <title>Search Page</title> <link rel="stylesheet" type="text/css" href="design.css"> </head> <body> <div class ="profile"> <imgd><img src="<?php
function appOption($app, $option) { //先清空数据 $db->query("TRUNCATE TABLE `" . dbprefix . $app . "_options`"); foreach ($option as $key => $item) { $optionname = $key; $optionvalue = trim($item); $this->create($app . '_options', array('optionname' => $optionname, 'optionvalue' => $optionvalue)); } $arrOptions = $this->findAll($app . '_options', null, null, 'optionname,optionvalue'); foreach ($arrOptions as $item) { $arrOption[$item['optionname']] = $item['optionvalue']; } fileWrite($app . '_options.php', 'data', $arrOption); $tsMySqlCache->set($app . '_options', $arrOption); }
<?php defined('IN_TS') or die('Access Denied.'); switch ($ts) { //基本配置 case "": $arrOptions = $new['photo']->findAll('photo_options'); foreach ($arrOptions as $item) { $strOption[$item['optionname']] = stripslashes($item['optionvalue']); } include template("admin/options"); break; case "do": //先清空数据 $db->query("TRUNCATE TABLE `" . dbprefix . "photo_options`"); foreach ($_POST['option'] as $key => $item) { $optionname = $key; $optionvalue = trim($item); $new['photo']->create('photo_options', array('optionname' => $optionname, 'optionvalue' => $optionvalue)); } $arrOptions = $new['photo']->findAll('photo_options', null, null, 'optionname,optionvalue'); foreach ($arrOptions as $item) { $arrOption[$item['optionname']] = $item['optionvalue']; } fileWrite('photo_options.php', 'data', $arrOption); $tsMySqlCache->set('photo_options', $arrOption); qiMsg('修改成功!'); break; }
/** * Writes the data to the config files * * @author Chris Smith <*****@*****.**> * * @param array $d * @return bool */ function store_data($d) { global $LC; $ok = true; $d['policy'] = (int) $d['policy']; // create local.php $now = gmdate('r'); $output = <<<EOT <?php /** * Dokuwiki's Main Configuration File - Local Settings * Auto-generated by install script * Date: {$now} */ EOT; // add any config options set by a previous installer $preset = __DIR__ . '/install.conf'; if (file_exists($preset)) { $output .= "# preset config options\n"; $output .= file_get_contents($preset); $output .= "\n\n"; $output .= "# options selected in installer\n"; @unlink($preset); } $output .= '$conf[\'title\'] = \'' . addslashes($d['title']) . "';\n"; $output .= '$conf[\'lang\'] = \'' . addslashes($LC) . "';\n"; $output .= '$conf[\'license\'] = \'' . addslashes($d['license']) . "';\n"; if ($d['acl']) { $output .= '$conf[\'useacl\'] = 1' . ";\n"; $output .= "\$conf['superuser'] = '******';\n"; } if (!$d['allowreg']) { $output .= '$conf[\'disableactions\'] = \'register\'' . ";\n"; } $ok = $ok && fileWrite(DOKU_LOCAL . 'local.php', $output); if ($d['acl']) { // hash the password $phash = new PassHash(); $pass = $phash->hash_smd5($d['password']); // create users.auth.php // --- user:SMD5password:Real Name:email:groups,comma,seperated $output = join(":", array($d['superuser'], $pass, $d['fullname'], $d['email'], 'admin,user')); $output = @file_get_contents(DOKU_CONF . 'users.auth.php.dist') . "\n{$output}\n"; $ok = $ok && fileWrite(DOKU_LOCAL . 'users.auth.php', $output); // create acl.auth.php $output = <<<EOT # acl.auth.php # <?php exit()?> # Don't modify the lines above # # Access Control Lists # # Auto-generated by install script # Date: {$now} EOT; if ($d['policy'] == 2) { $output .= "* @ALL 0\n"; $output .= "* @user 8\n"; } elseif ($d['policy'] == 1) { $output .= "* @ALL 1\n"; $output .= "* @user 8\n"; } else { $output .= "* @ALL 8\n"; } $ok = $ok && fileWrite(DOKU_LOCAL . 'acl.auth.php', $output); } // enable popularity submission if ($d['pop']) { @touch(DOKU_INC . 'data/cache/autosubmit.txt'); } // disable auth plugins til needed $output = <<<EOT <?php /* * Local plugin enable/disable settings * * Auto-generated by install script * Date: {$now} */ \$plugins['authad'] = 0; \$plugins['authldap'] = 0; \$plugins['authmysql'] = 0; \$plugins['authpgsql'] = 0; EOT; $ok = $ok && fileWrite(DOKU_LOCAL . 'plugins.local.php', $output); return $ok; }
<?php defined('IN_TS') or die('Access Denied.'); //插件编辑 switch ($ts) { case "set": $strGonggao = fileRead('data/plugins_pubs_gonggao.php'); if ($strGonggao == '') { $strGonggao = $tsMySqlCache->get('plugins_pubs_gonggao'); } include 'edit_set.html'; break; case "do": $title = trim($_POST['title']); $url = trim($_POST['url']); $arrData = array('title' => $title, 'url' => $url); fileWrite('plugins_pubs_gonggao.php', 'data', $arrData); $tsMySqlCache->set('plugins_pubs_gonggao', $arrData); header('Location: ' . SITE_URL . 'index.php?app=pubs&ac=plugin&plugin=gonggao&in=edit&ts=set'); break; }
<?php defined('IN_TS') or die('Access Denied.'); switch ($ts) { case "set": $arrData = fileRead('data/plugins_pubs_weibo.php'); if ($arrData == '') { $arrData = $tsMySqlCache->get('plugins_pubs_weibo'); } include 'html/edit.html'; break; case "do": $wb_akey = trim($_POST['wb_akey']); $wb_skey = trim($_POST['wb_skey']); $siteurl = $_POST['siteurl']; $arrData = array('wb_akey' => $wb_akey, 'wb_skey' => $wb_skey, 'siteurl' => $siteurl); fileWrite('plugins_pubs_weibo.php', 'data', $arrData); $tsMySqlCache->set('plugins_pubs_weibo'); header('Location: ' . SITE_URL . 'index.php?app=pubs&ac=plugin&plugin=weibo&in=edit&ts=set'); break; }
<?php //更新统计活动分类缓存 $arrTypess = $db->fetch_all_assoc("select * from " . dbprefix . "event_type"); foreach ($arrTypess as $key => $item) { $event = $db->once_fetch_assoc("select count(eventid) from " . dbprefix . "event where typeid='" . $item['typeid'] . "'"); $arrTypes['list'][] = array('typeid' => $item['typeid'], 'typename' => $item['typename'], 'count_event' => $event['count(eventid)']); } $eventNum = $db->once_fetch_assoc("select count(eventid) from " . dbprefix . "event"); $arrTypes['count'] = $eventNum['count(eventid)']; //生成缓存文件 fileWrite('event_types.php', 'data', $arrTypes); qiMsg("更新成功!");
include 'thinksaas/pclzip.lib.php'; $archive = new PclZip('upgrade/' . $filezip); if ($archive->extract(PCLZIP_OPT_PATH, 'upgrade', PCLZIP_OPT_REPLACE_NEWER) == 0) { //die("Error : ".$archive->errorInfo(true)); echo '0'; exit; //解压失败 } else { unlink('upgrade/' . $filezip); } //直接循环覆盖吧 $filers = file_list('upgrade/thinksaas'); if ($filers) { echo '1'; exit; } //删除目录 delDirAndFile('upgrade/thinksaas'); //更新数据库配置缓存下 $arrOptions = $new['system']->findAll('system_options', null, null, 'optionname,optionvalue'); foreach ($arrOptions as $item) { $arrOption[$item['optionname']] = $item['optionvalue']; } fileWrite('system_options.php', 'data', $arrOption); $tsMySqlCache->set('system_options', $arrOption); //删除模板缓存 rmrf('cache/template'); echo '2'; exit; break; }
<?php defined('IN_TS') or die('Access Denied.'); //插件编辑 switch ($ts) { case "set": $code = fileRead('data/plugins_pubs_feedback.php'); if ($code == '') { $code = $tsMySqlCache->get('plugins_pubs_feedback'); } $code = stripslashes($code); include 'edit_set.html'; break; case "do": $code = trim($_POST['code']); fileWrite('plugins_pubs_feedback.php', 'data', $code); $tsMySqlCache->set('plugins_pubs_feedback', $code); header('Location: ' . SITE_URL . 'index.php?app=pubs&ac=plugin&plugin=feedback&in=edit&ts=set'); break; }
<?php include 'session.php'; $usern = $_SESSION['login_user']; $conn1 = $_SESSION['conn']; $usid = $_SESSION['login_id']; require_once 'file.php'; $pro = mysqli_query($conn1, "select * from user where id = (select id from login where username='******')"); if (isset($_POST['submit'])) { $fn = $_POST['fname']; $ln = $_POST['lname']; $dob = $_POST['dob']; $directory = "profilepic/"; $target_file = $directory . basename($_FILES["propic"]["name"]); //echo $target_file; if (move_uploaded_file($_FILES["propic"]["tmp_name"], $target_file)) { fileWrite("---Result---", "File moved successfully"); } else { fileWrite("---Result---", "File moving unsuccessful"); } // $pic=$_REQUEST['propic']; // fileWrite("---comment---",$pic); if (mysqli_num_rows($pro) == 1) { mysqli_query($conn1, "UPDATE user SET firstname='{$fn}',lastname='{$ln}',picture='{$target_file}',dob='{$dob}' WHERE id = (select id from login where username='******')"); } else { mysqli_query($conn1, "INSERT into user(id,firstname,lastname,picture,dob) VALUES ({$usid},{$fn},{$ln},NULL,{$dob}) "); } } header('location:profile.php'); ?>
public function store($id, $obj, $tags) { if ($tags !== false) { $this->updateTags($tags, $id); } if (fileWrite($this->dir . '/' . $id, serialize($obj)) === false) { throw new DBException(); } }
<?php defined('IN_TS') or die('Access Denied.'); switch ($ts) { //基本配置 case "": $arrOptions = $new['attach']->findAll('attach_options'); foreach ($arrOptions as $item) { $strOption[$item['optionname']] = stripslashes($item['optionvalue']); } include template("admin/options"); break; case "do": //先清空数据 $db->query("TRUNCATE TABLE `" . dbprefix . "attach_options`"); foreach ($_POST['option'] as $key => $item) { $optionname = $key; $optionvalue = trim($item); $new['attach']->create('attach_options', array('optionname' => $optionname, 'optionvalue' => $optionvalue)); } $arrOptions = $new['attach']->findAll('attach_options', null, null, 'optionname,optionvalue'); foreach ($arrOptions as $item) { $arrOption[$item['optionname']] = $item['optionvalue']; } fileWrite('attach_options.php', 'data', $arrOption); $tsMySqlCache->set('attach_options', $arrOption); qiMsg('修改成功!'); break; }
/** * Overrides PHP's default error handler. This function is enabled/disabled * in the loadErrorHandler() function * * Inherits error & logging info from default handler and allows us to display * custom error messages based on the following boolean constants: * * 1 SHOW_ALL_ERRORS * 2 LOG_ALL_ERRORS * * @param string $e_number error number provided by PHP error handler * @param string $e_message error message provided by PHP error handler * @param string $e_file file name provided by PHP error handler * @param string $e_line line number of error provided by PHP error handler * @param array $e_vars variables present at time of error * @return void * @see loadErrorHandler() * @todo in production, send email to admin if threshold number/type of errors is exceeded */ function myErrorHandler($e_number, $e_message, $e_file, $e_line, $e_vars) { #comment out one of the two $errFile variables - one for a single file, one for a new file every day $errFile = 'error_log_' . date('m-d-Y') . '.txt'; #new error file created every day #$errFile = 'error_log'; # same single error log file as PHP will write errors static $counter = 0; # Will identify if myError() was called more than once $counter++; if (LOG_ALL_ERRORS) { # Copy all error info to error log file try { $errInfo = "[" . date('M-d-Y G:i:s') . "] {$e_message} in {$e_file} on line {$e_line}" . "\n"; fileWrite(LOG_PATH . $errFile, 'a+', $errInfo); if (substr(sprintf('%o', fileperms(LOG_PATH . $errFile)), -4) != '0700') { //check file permission - if NOT set to 0700, fix it! chmod(LOG_PATH . $errFile, 0700); } } catch (Exception $e) { //echo 'Caught exception: ', $e->getMessage(), "\n"; } } if (SHOW_ALL_ERRORS || isset($_SESSION['AdminID'])) { # Display generic error message, with support email from config file printDeveloperError($e_file, $e_line, $e_message, $counter); } else { # Show errors directly on page. (troubleshooting purposes only!) if ($counter < 2) { printUserError($e_file, $e_line); } #only print one error message to user } }