Comsenz Inc.'; var $magic = array(); var $parameters = array(); var $idtypearray = array('blogid', 'tid'); function getsetting(&$magic) { global $_G; $settings = array( 'expiration' => array( 'title' => 'highlight_expiration', 'type' => 'text', 'value' => '', 'default' => 24, ), 'fids' => array( 'title' => 'highlight_forum', 'type' => 'mselect', 'value' => array(), ), ); loadcache('forums'); $settings['fids']['value'][] = array(0, ' '); if(empty($_G['cache']['forums'])) $_G['cache']['forums'] = array(); foreach($_G['cache']['forums'] as $fid => $forum) { $settings['fids']['value'][] = array($fid, ($forum['type'] == 'forum' ? str_repeat(' ', 4) : ($forum['type'] == 'sub' ? str_repeat(' ', 8) : '')).$forum['name']); } $magic['fids'] = explode("\t", $magic['forum']); return $settings; } function setsetting(&$magicnew, &$parameters) { global $_G; $magicnew['forum'] = is_array($parameters['fids']) && !empty($parameters['fids']) ? implode("\t",$parameters['fids']) : ''; $magicnew['expiration'] = intval($parameters['expiration']); } function usesubmit() { global $_G; $idtype = !empty($_GET['idtype']) ? $_GET['idtype'] : ''; if(!in_array($idtype, $this->idtypearray)) { showmessage(lang('magic/highlight', 'highlight_info_notype'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => true)); } if(empty($_GET['id'])) { showmessage(lang('magic/highlight', 'highlight_info_nonexistence_'.$idtype)); } if($idtype == 'tid') { $info = getpostinfo($_GET['id'], $idtype, array('fid', 'authorid', 'subject')); $this->_check($info['fid']); magicthreadmod($_GET['id']); C::t('forum_thread')->update($_GET['id'], array('highlight' => $_GET['highlight_color'], 'moderated' => 1)); $this->parameters['expiration'] = $this->parameters['expiration'] ? intval($this->parameters['expiration']) : 24; $expiration = TIMESTAMP + $this->parameters['expiration'] * 3600; updatemagicthreadlog($_GET['id'], $this->magic['magicid'], $expiration > 0 ? 'EHL' : 'HLT', $expiration); if($info['authorid'] != $_G['uid']) { notification_add($info['authorid'], 'magic', lang('magic/highlight', 'highlight_notification'), array('tid' => $_GET['id'], 'subject' => $info['subject'], 'magicname' => $this->magic['name'])); } } elseif($idtype == 'blogid') { $info = getpostinfo($_GET['id'], $idtype, array('uid', 'subject')); C::t('home_blogfield')->update($_GET['id'], array('magiccolor' => $_GET['highlight_color'])); if($info['uid'] != $_G['uid']) { notification_add($info['uid'], 'magic', lang('magic/highlight', 'highlight_notification_blogid'), array('blogid' => $_GET['id'], 'subject' => $info['subject'], 'magicname' => $this->magic['name'])); } } usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', 0, $idtype, $_GET['id']); showmessage(lang('magic/highlight', 'highlight_succeed_'.$idtype), dreferer(), array(), array('alert' => 'right', 'showdialog' => 1, 'locationtime' => true)); } function show() { global $_G; $id = !empty($_GET['id']) ? dhtmlspecialchars($_GET['id']) : ''; $idtype = !empty($_GET['idtype']) ? $_GET['idtype'] : ''; if(!in_array($idtype, $this->idtypearray)) { showmessage(lang('magic/highlight', 'highlight_info_notype'), dreferer(), array(), array('showdialog' => 1, 'locationtime' => true)); } if($id) { $info = getpostinfo($_GET['id'], $idtype); if($idtype == 'tid') { $this->_check($info['fid']); $this->parameters['expiration'] = $this->parameters['expiration'] && $idtype == 'tid' ? intval($this->parameters['expiration']) : 24; } } magicshowtype('top'); $lang = lang('magic/highlight'); magicshowsetting(lang('magic/highlight', 'highlight_info_'.$idtype, array('expiration' => $this->parameters['expiration'])), 'id', $id, 'hidden'); echo <<$lang[highlight_color]

^
EOF; magicshowtype('bottom'); } function buy() { global $_G; $idtype = !empty($_GET['idtype']) ? $_GET['idtype'] : ''; if(!empty($_GET['id'])) { $info = getpostinfo($_GET['id'], $idtype); if($idtype == 'tid') { $this->_check($info['fid']); } } } function _check($fid) { if(!checkmagicperm($this->parameters['forum'], $fid)) { showmessage(lang('magic/highlight', 'highlight_info_noperm')); } } } ?>