public function action_message() { $message = ORM::factory('Message', $this->request->param('id')); if (!$message->loaded()) { ajax::redirect('#/messages', __('The message wasn\'t found. Has it already been deleted?')); } $info = $message->info(); if ($message->read == 0) { $message->set_read(); } reply::ok(View::factory('Cms/Messages/message', array('message' => $message)), 'messages', array('viewModel' => 'viewModels/Messages/message', 'message' => $info)); }
public function action_index() { $limit = 30; $page = arr::get($_GET, 'p', 1); $page = $page - 1; $files = ORM::factory('File')->limit($limit)->offset($page * $limit)->find_all(); $filesarr = array(); if ((bool) $files->count()) { foreach ($files as $file) { $filesarr[] = $file->info(); } } $total = ORM::factory('File')->count_all(); $total = ceil($total / $limit); $view = View::factory('Cms/Files/index2'); reply::ok($view, 'files', array('viewModel' => 'viewModels/Files/index2', 'files' => $filesarr)); }
public function action_options() { $optiongroups = ORM::factory('Optiongroup')->find_all(); $grouparr = array(); if ((bool) $optiongroups->count()) { foreach ($optiongroups as $group) { $info = $group->info(); $info['options'] = array(); $options = $group->options->find_all(); if ((bool) $options->count()) { foreach ($options as $option) { $info['options'][] = $option->info(); } } $grouparr[] = $info; } } $view = View::factory('Cms/Super/options'); reply::ok($view, 'files', array('viewModel' => 'viewModels/Super/options', 'groups' => $grouparr)); }
public function action_index() { reply::ok(View::factory('Cms/Navigation/index'), 'navigation', array('viewModel' => 'viewModels/Navigation/index')); }
<?php defined('DT_ADMIN') or exit('Access Denied'); $tid = isset($tid) ? intval($tid) : 0; $gid = isset($gid) ? intval($gid) : 0; require MD_ROOT . '/reply.class.php'; $do = new reply(); $menus = array(array('回复列表', '?moduleid=' . $moduleid . '&file=' . $file . '&tid=' . $tid), array('待审核', '?moduleid=' . $moduleid . '&file=' . $file . '&tid=' . $tid . '&action=check'), array('未通过', '?moduleid=' . $moduleid . '&file=' . $file . '&tid=' . $tid . '&action=reject'), array('回收站', '?moduleid=' . $moduleid . '&file=' . $file . '&tid=' . $tid . '&action=recycle')); if (in_array($action, array('', 'check', 'reject', 'recycle'))) { $sfields = array('内容', '会员名', '昵称', '编辑', 'IP'); $dfields = array('content', 'username', 'passport', 'editor', 'ip'); $sorder = array('结果排序方式', '添加时间降序', '添加时间升序'); $dorder = array('itemid desc', 'addtime DESC', 'addtime ASC'); isset($fields) && isset($dfields[$fields]) or $fields = 0; isset($order) && isset($dorder[$order]) or $order = 0; isset($ip) or $ip = ''; $fromdate = isset($fromdate) && is_date($fromdate) ? $fromdate : ''; $fromtime = $fromdate ? strtotime($fromdate . ' 0:0:0') : 0; $todate = isset($todate) && is_date($todate) ? $todate : ''; $totime = $todate ? strtotime($todate . ' 23:59:59') : 0; $fields_select = dselect($sfields, 'fields', '', $fields); $order_select = dselect($sorder, 'order', '', $order); $condition = ''; if ($keyword) { $condition .= in_array($dfields[$fields], array('gid', 'itemid', 'ip')) ? " AND {$dfields[$fields]}='{$kw}'" : " AND {$dfields[$fields]} LIKE '%{$keyword}%'"; } if ($tid) { $condition .= " AND tid='{$tid}'"; } if ($gid) { $condition .= " AND gid='{$gid}'";
/** * Post a new reply. */ public function post_reply($contents, $anonymous = 0) { global $DB, $USER, $PAGE; $reply = new \stdClass(); $reply->qaqid = $this->id; $reply->userid = $USER->id; $reply->anonymous = $anonymous; $reply->content = $contents; $reply->timecreated = time(); $reply->timemodified = time(); $id = $DB->insert_record('qa_replies', $reply); $reply->id = $id; $event = \mod_qa\event\reply_posted::create(array('objectid' => $reply->id, 'context' => $PAGE->context, 'userid' => $anonymous ? 0 : $USER->id, 'other' => array('questionid' => $this->id, 'questiontitle' => $this->title))); $event->add_record_snapshot('qa_replies', $reply); $event->trigger(); return reply::from_db($reply); }
<?php defined('IN_DESTOON') or exit('Access Denied'); $MG['club_reply_limit'] > -1 or dalert(lang('message->without_permission_and_upgrade'), 'goback'); require MD_ROOT . '/reply.class.php'; $do = new reply(); $sql = $_userid ? "username='******'" : "ip='{$DT_IP}'"; $limit_used = $limit_free = $need_password = $need_captcha = $need_question = $fee_add = 0; $today = $today_endtime - 86400; if (in_array($action, array('', 'add')) && $MG['club_reply_limit']) { $r = $db->get_one("SELECT COUNT(*) AS num FROM {$table}_reply WHERE {$sql} AND status>1 AND addtime>{$today}"); $limit_used = $r['num']; $limit_free = $MG['club_reply_limit'] > $limit_used ? $MG['club_reply_limit'] - $limit_used : 0; } switch ($action) { case 'add': check_group($_groupid, $MOD['group_reply']) or dalert(lang('message->without_permission_and_upgrade'), 'goback'); $tid = isset($tid) ? intval($tid) : 0; $tid or dalert($L['my_choose_post'], $MOD['linkurl']); $T = $db->get_one("SELECT * FROM {$table} WHERE itemid={$tid}"); $T && $T['status'] == 3 or dalert($L['my_not_post']); $gid = $T['gid']; $GRP = get_group($gid); $GRP && $GRP['status'] == 3 or dalert($L['my_not_group']); if ($MG['club_reply_limit'] && $limit_used >= $MG['club_reply_limit']) { dalert(lang($L['day_limit'], array($MG['club_reply_limit'], $limit_used)), $MODULE[2]['linkurl'] . $DT['file_my'] . '?mid=' . $mid . '&job=' . $job); } if ($GRP['reply_type'] && !is_fans($GRP)) { $action = 'reply'; $head_title = lang('message->without_permission'); exit(include template('nofans', $module));
$error = htmlspecialchars($staff->get_error(), ENT_QUOTES); } } if (isset($_POST['message'])) { $reply = new reply(); $reply->db_open(); if (!($addreply = $reply->add_reply($tid, $_SESSION['uid'], $_POST['message'], $admin))) { $newreplyerror = htmlspecialchars($reply->get_error(), ENT_QUOTES); } } $ticketdetails = $ticket->get_ticket($tid); if ($ticketdetails) { if ($ticketdetails['uid'] == $_SESSION['uid'] || $admin) { if ($userdetails = $user->get_userdata($ticketdetails['uid'])) { if ($ticketdetails) { $reply = new reply(); $reply->db_open(); if (!($getreplies = $reply->get_ticket_replies($tid))) { $replyerror = htmlspecialchars($reply->get_error(), ENT_QUOTES); } } else { $error = $user->get_error(); } } else { $error = $user->get_error; } } else { header('Location: http://' . $_SERVER['SERVER_NAME'] . '/newticket/index.php?error=1'); } } else { $error = htmlspecialchars($ticket->get_error(), ENT_QUOTES);
public function action_index() { $view = View::factory('Cms/Options/index'); reply::ok($view, 'options', array('viewModel' => 'viewModels/Options/index')); }
message($do->errmsg); } } else { extract($R); } break; case 'reply_delete': $itemid && is_array($itemid) or message($L['my_choose_reply']); $content = ''; if ($reason == $L['my_manage_reason']) { $reason = ''; } $reason = dhtmlspecialchars($reason); $message = isset($message) ? 1 : 0; require MD_ROOT . '/reply.class.php'; $do = new reply(); foreach ($itemid as $rid) { $do->itemid = $rid; $R = $do->get_one(); if (!$R || $R['status'] != 3 || $R['gid'] != $gid) { continue; } $do->recycle($rid); if ($message) { send_message($R['username'], lang($L['manage_msg_title'], array($L['my_manage_type_reply'], get_intro($R['content'], 20), $L['my_manage_type_del'])), lang($L['manage_msg_content'], array($MOD['linkurl'] . 'goto.php?itemid=' . $R['itemid'], nl2br($reason), $_username))); } $title = addslashes(get_intro($R['content'], 50)); $db->query("INSERT INTO {$table}_manage (gid,rid,username,addtime,typeid,title,content,reason,message) VALUES ('{$gid}','{$rid}','{$_username}','{$DT_TIME}','1','{$title}','{$content}','{$reason}','{$message}')"); } dmsg($L['reply_success_del'], $forward); break;
public function action_index() { reply::ok(View::factory('Cms/Controlpanel/index'), 'welcome', array('viewModel' => 'viewModels/Controlpanel/index')); }
$need_captcha = $MOD['captcha_reply'] == 2 ? $MG['captcha'] : $MOD['captcha_reply']; $need_question = $MOD['question_reply'] == 2 ? $MG['question'] : $MOD['question_reply']; if ($need_question) { $need_captcha = 1; } if (isset($_POST['ok'])) { $captcha = isset($captcha) ? convert(input_trim($captcha), 'UTF-8', DT_CHARSET) : ''; $msg = captcha($captcha, $need_captcha, true); if ($msg) { exit('captcha'); } $post = array(); $post['content'] = isset($content) ? convert(input_trim(nl2br($content)), 'UTF-8', DT_CHARSET) : ''; require DT_ROOT . '/include/post.func.php'; require MD_ROOT . '/reply.class.php'; $do = new reply($moduleid); if ($do->pass($post)) { $post['tid'] = $tid; $post['gid'] = $gid; $need_check = $MOD['check_reply'] == 2 ? $MG['check'] : $MOD['check_reply']; $post['status'] = get_status(3, $need_check); $post['username'] = $_username; $do->add($post); exit($post['status'] == 3 ? 'ok' : 'check'); } exit('ko'); } $head_title = $L['reply_title'] . $DT['seo_delimiter'] . $head_title; $foot = ''; include template('club_reply', 'mobile'); if (DT_CHARSET != 'UTF-8') {
<?php if (isset($_GET["thread_id"]) and isset($_GET["cat_id"])) { $Thread_editor = new Thread_editor($conn); //shows whole thread info, like thread body, title, thread by and time. $Show_thread_body = new Data_display($conn); //show thread body. $Show_thread_body->show_thread_body(); //show thread replies. $Show_thread_body->show_replies(); //code below only runs if user is logged in. if ($Thread_editor->is_user_logged_in("logged_in")) { //***************************************************************************// //*****************TAKES CARE OF SHOWING REPLY OPTIONS***********************// //***************************************************************************// //do these if only is user if logged in. this also shows the form to reply if user if logged in. $Post_reply = new reply($conn); $Post_reply->show_form(); //takes care of making sure user is logged in. thread_id and cat_id variables exist, reply length and empty reply... if ($Post_reply->set_reply()) { $Post_reply->post_reply(); } //***************************************************************************// //***************************************************************************// //*******************TAKES CARE OF EDITING THREAD****************************// //***************************************************************************// $Thread_editor = new Thread_editor($conn); //if user is allowed to edit the thread, either is admin or owns the thread. if ($Thread_editor->check_if_allowed_to_edit()) { echo "Edit thread"; //show user the form. $Thread_editor->show_edit_form();
pcntl_signal(SIGALRM, SIG_IGN); pcntl_signal(SIGINT, SIG_IGN); pcntl_signal(SIGUSR1, SIG_IGN); pcntl_signal(SIGUSR2, SIG_IGN); pcntl_signal(SIGHUP, SIG_IGN); pcntl_signal(SIGCHLD, "sig_handler"); pcntl_signal_dispatch(); while (true) { $child++; $pid = pcntl_fork(); if ($pid) { echo 'starting new child'."\n"; if ($child >= $max) { pcntl_wait($status); } } else{ while (true) { $robot = new reply(); $robot->connect(); $robot->getSource(); $robot->close(); sleep(2); echo "query come \n"; } } }
public function replies($index = null) { global $DB; if (empty($this->_replies)) { // only all replies in an open or close state, a reply should never be automated // and drafts are no in the line of published conversation. $items = array(dialogue::STATE_OPEN, dialogue::STATE_CLOSED); list($insql, $inparams) = $DB->get_in_or_equal($items, SQL_PARAMS_NAMED, 'viewstate'); $sql = "SELECT dm.*\n FROM {dialogue_messages} dm\n WHERE dm.conversationindex > 1\n AND dm.state {$insql}\n AND dm.conversationid = :conversationid\n ORDER BY dm.conversationindex ASC"; $params = array('conversationid' => $this->conversationid) + $inparams; $records = $DB->get_records_sql($sql, $params); foreach ($records as $record) { $reply = new reply($this->_dialogue, $this); $reply->load($record); $this->_replies[$record->id] = $reply; } } if ($index) { if (!isset($this->_replies[$index])) { throw new \coding_exception('index not defined'); } return $this->_replies[$index]; } return $this->_replies; }
public function action_new() { $view = View::factory('Cms/Users/new'); reply::ok($view, 'users', array('viewModel' => 'viewModels/Users/new')); }
public function action_edit() { $content = ORM::factory('Content', $this->request->param('id')); if (!$content->loaded()) { notes::add('error', 'Indholdet blev ikke fundet.'); //cms::redirect(); } $view = View::factory('Cms/Content/edit', array('content' => $content)); $tags = DB::select('tag_id')->from('contents_tags')->group_by('tag_id')->execute(); $alltags = array(); if ((bool) $tags->count()) { foreach ($tags as $tag) { $tag = ORM::factory('Tag', arr::get($tag, 'tag_id')); $alltags[] = array('title' => $tag->tag, 'id' => $tag->id, 'slug' => $tag->slug); } } reply::ok($view, 'contenttype-' . $content->contenttype_id, array('viewModel' => 'viewModels/Content/edit', 'alltags' => $alltags)); }
/** * Returns questions. */ public function get_questions() { global $DB; if (!isset($this->questions)) { $questions = $DB->get_records('qa_questions', array('qaid' => $this->data->id)); $this->questions = array(); if (empty($questions)) { return array(); } $ids = array_keys($questions); list($sql, $params) = $DB->get_in_or_equal($ids); $replies = $DB->get_records_sql('SELECT * FROM {qa_replies} WHERE qaqid ' . $sql, $params); $votes = $DB->get_records_sql('SELECT * FROM {qa_votes} WHERE qaqid ' . $sql, $params); foreach ($questions as $question) { $this->questions[$question->id] = question::from_db($question); $this->questions[$question->id]->qa = $this; $this->questions[$question->id]->replies = array(); foreach ($replies as $reply) { if ($reply->qaqid == $question->id) { $this->questions[$question->id]->replies[$reply->id] = reply::from_db($reply); } } $this->questions[$question->id]->votes = array(); foreach ($votes as $vote) { if ($vote->qaqid == $question->id) { $this->questions[$question->id]->votes[$vote->userid] = true; } } } } return $this->questions; }