function plugin_basic_auth_save() { if (z(t(v('bauth_password'))) != z(t(v('bauth_password2')))) { return ajax_echo('两次输入的密码不一致,请重新输入'); } $bauth_username = z(t(v('bauth_username'))); $bauth_password = z(t(v('bauth_password'))); $bauth_on = intval(t(v('bauth_on'))); kset('bauth_username', $bauth_username); kset('bauth_password', $bauth_password); kset('bauth_on', $bauth_on); return ajax_echo('设置已保存<script>setTimeout( close_float_box, 500)</script>'); }
function plugin_basic_auth_save() { if (z(t(v('bauth_password'))) != z(t(v('bauth_password2')))) { return ajax_echo(__('PL_BASIC_AUTH_PASSWORD_NOT_SAME')); } $bauth_username = z(t(v('bauth_username'))); $bauth_password = z(t(v('bauth_password'))); $bauth_on = intval(t(v('bauth_on'))); kset('bauth_username', $bauth_username); kset('bauth_password', $bauth_password); kset('bauth_on', $bauth_on); return ajax_echo(__('PL_BASIC_AUTH_SETTINGS_UPDATED') . '<script>setTimeout( close_float_box, 500)</script>'); }
/** * @ignore */ private function todo_set_value($field, $value) { $tid = intval(v('tid')); if ($tid < 1) { return self::send_error(LR_API_ARGS_ERROR, __('INPUT_CHECK_BAD_ARGS', 'TID')); } $sql = "SELECT * FROM `todo_user` WHERE `tid` = '" . intval($tid) . "' AND `uid` = '" . intval($_SESSION['uid']) . "' LIMIT 1"; if (!($data = get_line($sql))) { return self::send_error(LR_API_FORBIDDEN, __('API_MESSAGE_CANNOT_UPDATE_OTHERS_TODO')); } // delete uid and limit 1 // to make all record updated at sametime // for all the followers $sql = "UPDATE `todo_user` SET `" . s($field) . "` = '" . intval($value) . "' , `last_action_at` = NOW() WHERE `tid` = '" . intval($tid) . "' "; run_sql($sql); if (mysql_errno() != 0) { return self::send_error(LR_API_DB_ERROR, __('API_MESSAGE_DATABASE_ERROR') . mysql_error()); } else { $todoinfo = get_todo_info_by_id($tid, true); kset('dinfo', $todoinfo['details']['is_public']); if ($field == 'status' && $value == 3) { if ($todoinfo['details']['is_public'] == 1) { // .'完成了TODO【'. .'】' publish_feed(__('API_TEXT_FINISH_TODO', array(uname(), $todoinfo['content'])), uid(), 2, $tid); // send notice // 向订阅todo的同学发送通知 $sql = "SELECT `uid` FROM `todo_user` WHERE `tid`= '" . intval($tid) . "' AND `is_follow` = 1 "; if ($uitems = get_data($sql)) { foreach ($uitems as $uitem) { if ($uitem['uid'] != uid()) { send_notice($uitem['uid'], __('API_TEXT_FINISH_TODO_FOLLOWED', array(uname(), $todoinfo['content'])), 1, array('tid' => intval($tid), 'count' => $todoinfo['comment_count'])); } } } } } return self::send_result($todoinfo); } }
public function asettings_save() { //print_r( $_REQUEST ); $action = z(t(v('action'))); $table = z(t(v('table'))); if (strlen($action) < 1 || strlen($table) < 1) { return ajax_echo('参数不完整'); } if ($_REQUEST['st']['public'] == 1) { $_REQUEST['st']['basic'] == 0; } else { $_REQUEST['st']['basic'] == 1; } if ($_REQUEST['st']['on'] == 1) { $_REQUEST['st']['off'] == 0; } else { $_REQUEST['st']['off'] == 1; } kset('msetting_' . $table . '_' . $action, serialize(v('st'))); //echo 'msetting_' . $table . '_' . $action . '_' . $field . '`~'.serialize( v('st') ); //print_r( $kv ); //echo $kv->get( 'msetting_' . $table . '_' . $action ); return ajax_echo('<script>window.location.reload();</script>'); }
function plugin_mset() { if (intval(v('on')) == 1) { kset('mqueue_usettings_' . uid(), 1); } else { kset('mqueue_usettings_' . uid(), 0); } }
function plugin_dropbox_save() { $dropbox_on = intval(t(v('dropbox_on'))); $dropbox_akey = z(t(v('dropbox_akey'))); if (strlen($dropbox_akey) < 1) { return ajax_echo(__('PL_DROPBOX_SETTINGS_CANNOT_EMPTY')); } kset('dropbox_on', $dropbox_on); kset('dropbox_akey', $dropbox_akey); return ajax_echo(__('PL_DROPBOX_SETTINGS_UPDATED') . '<script>setTimeout( close_float_box, 500)</script>'); }
function sendcloud_mail($to, $subject, $content, $bcc = false) { $to = str_replace(',', ';', $to); $option = array('api_user' => kget('sendcloud_user'), 'api_key' => kget('sendcloud_key'), 'from' => kget('sendcloud_from'), 'to' => $to, 'subject' => $subject, 'html' => $content); if ($bcc !== false) { $option['bcc'] = $bcc; } $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($ch, CURLOPT_URL, kget('sendcloud_url')); curl_setopt($ch, CURLOPT_POSTFIELDS, $option); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3); $result = curl_exec($ch); curl_close($ch); $ret = json_decode($result, 1); kset('last-sendcloud-info', $result); return strtolower($ret['message']) == 'success'; }
function plugin_openid_auth_save() { $openid_auth_email_pattern = z(t(v('openid_auth_email_pattern'))); kset('openid_auth_email_pattern', $openid_auth_email_pattern); ajax_echo(__('PL_OPENID_AUTH_SETTINGS_UPDATED') . '<script>setTimeout( close_float_box, 500)</script>'); }
/** * @ignore */ private function todo_set_value($field, $value) { $tid = intval(v('tid')); if ($tid < 1) { return $this->send_error(LR_API_ARGS_ERROR, 'id FIELD REQUIRED'); } $sql = "SELECT * FROM `todo_user` WHERE `tid` = '" . intval($tid) . "' AND `uid` = '" . intval($_SESSION['uid']) . "' LIMIT 1"; if (!($data = get_line($sql))) { return $this->send_error(LR_API_FORBIDDEN, 'YOU CANNOT UPDATE OTHERS TODO'); } // delete uid and limit 1 // to make all record updated at sametime // for all the followers $sql = "UPDATE `todo_user` SET `" . s($field) . "` = '" . intval($value) . "' , `last_action_at` = NOW() WHERE `tid` = '" . intval($tid) . "' "; run_sql($sql); if (mysql_errno() != 0) { return $this->send_error(LR_API_DB_ERROR, 'DATABASE ERROR ' . mysql_error()); } else { $todoinfo = get_todo_info_by_id($tid, true); kset('dinfo', $todoinfo['details']['is_public']); if ($field == 'status' && $value == 3) { if ($todoinfo['details']['is_public'] == 1) { publish_feed(uname() . '完成了TODO【' . $todoinfo['content'] . '】', uid(), 2, $tid); // send notice // 向订阅todo的同学发送通知 $sql = "SELECT `uid` FROM `todo_user` WHERE `tid`= '" . intval($tid) . "' AND `is_follow` = 1 "; if ($uitems = get_data($sql)) { foreach ($uitems as $uitem) { if ($uitem['uid'] != uid()) { send_notice($uitem['uid'], uname() . '完成了你关注的TODO【' . $todoinfo['content'] . '】', 1, array('tid' => intval($tid), 'count' => $todoinfo['comment_count'])); } } } } } return $this->send_result($todoinfo); } }