| 1 | <?xml version="1.0" encoding="utf-8"?> |
|---|
| 2 | |
|---|
| 3 | <extension engine="1.0"> |
|---|
| 4 | <id>ajax_post_edit</id> |
|---|
| 5 | <title>Ajax Post Edit</title> |
|---|
| 6 | <version>1.7.1</version> |
|---|
| 7 | <description>This extension allows quickly edit post</description> |
|---|
| 8 | <author>Daris</author> |
|---|
| 9 | <minversion>1.3</minversion> |
|---|
| 10 | <maxtestedon>1.3.2</maxtestedon> |
|---|
| 11 | <hooks> |
|---|
| 12 | <hook id="ft_end"><![CDATA[ |
|---|
| 13 | if (FORUM_PAGE == 'viewtopic') { |
|---|
| 14 | preg_match_all("#\<div\sid\=\"p(\d*)\"#s", $tpl_main, $output); |
|---|
| 15 | foreach($output[1] as $s) { |
|---|
| 16 | $str = substr($tpl_main, strpos($tpl_main, '<div id="p'.$s.'"')); |
|---|
| 17 | $str = substr($str, 0, strpos($str, '</p>')); |
|---|
| 18 | $old = $str; |
|---|
| 19 | $str = str_replace('<div class="entry-content">', '<div id="post'.$s.'" class="entry-content">', $str); |
|---|
| 20 | $tpl_main = str_replace($old, $str, $tpl_main); |
|---|
| 21 | } |
|---|
| 22 | } |
|---|
| 23 | ]]></hook> |
|---|
| 24 | <hook id="hd_head"><![CDATA[ |
|---|
| 25 | |
|---|
| 26 | if (FORUM_PAGE == 'viewtopic') |
|---|
| 27 | { |
|---|
| 28 | if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'.php')) |
|---|
| 29 | require $ext_info['path'].'/lang/'.$forum_user['language'].'.php'; |
|---|
| 30 | else |
|---|
| 31 | require $ext_info['path'].'/lang/English.php'; |
|---|
| 32 | |
|---|
| 33 | $ape = 'var base_url = \''.$base_url.'\';'; |
|---|
| 34 | $ape .= "\n".'var ape = {\'csrf_token\' : \''.generate_form_token($ext_info['url'].'/edit.php').'\''; |
|---|
| 35 | $ape .= ', \'Loading\' : \''.$lang_ape['Loading'].'\''; |
|---|
| 36 | $ape .= ', \'Quick edit\' : \''.$lang_ape['Quick Edit'].'\''; |
|---|
| 37 | $ape .= ', \'Normal edit\' : \''.$lang_ape['Normal Edit'].'\''; |
|---|
| 38 | $ape .= ', \'url_edit\' : \''.$forum_url['edit'].'\''; |
|---|
| 39 | $ape .= '}'; |
|---|
| 40 | |
|---|
| 41 | $forum_head['ape_css'] = '<link rel="stylesheet" type="text/css" media="screen" href="'.$ext_info['url'].'/style.css" />'; |
|---|
| 42 | $forum_head['ape_js'] = '<script type="text/javascript">'."\n".$ape."\n".'</script>'; |
|---|
| 43 | $forum_head['ape_js2'] = '<script type="text/javascript" src="'.$ext_info['url'].'/ajax_post_edit.js"></script>'; |
|---|
| 44 | |
|---|
| 45 | if (file_exists($ext_info['path'].'/style/'.$forum_user['style'].'/style.css')) |
|---|
| 46 | $forum_head['ape_css_style'] = '<link rel="stylesheet" type="text/css" media="screen" href="'.$ext_info['url'].'/style/'.$forum_user['style'].'/style.css" />'; |
|---|
| 47 | else |
|---|
| 48 | $forum_head['ape_css_style'] = '<link rel="stylesheet" type="text/css" media="screen" href="'.$ext_info['url'].'/style/Oxygen/style.css" />'; |
|---|
| 49 | } |
|---|
| 50 | ]]></hook> |
|---|
| 51 | |
|---|
| 52 | <hook id="vt_row_pre_post_actions_merge"><![CDATA[ |
|---|
| 53 | if (!$forum_user['is_guest'] && ($forum_user['is_admmod'] || ($cur_post['poster_id'] == $forum_user['id'] && $forum_user['g_edit_posts'] == '1' && $cur_topic['closed'] == '0'))) |
|---|
| 54 | { |
|---|
| 55 | $content = '<span class="edit-post'.(!empty($forum_page['post_actions']) ? ' item1' : '').'" id="menu'.$cur_post['id'].'"><a href="javascript:ape_show_menu('. $cur_post['id'].')">'.$lang_topic['Edit'].'<span> '.$lang_topic['Post'].' '.forum_number_format($forum_page['start_from'] + $forum_page['item_count']).'</span></a></span>'; |
|---|
| 56 | |
|---|
| 57 | $noscript = '<noscript>' . $forum_page['post_actions']['edit'] . '</noscript>'; |
|---|
| 58 | |
|---|
| 59 | $forum_page['post_actions']['edit'] = '<script type="text/javascript">document.write(\'' . $content . '\')</script>'. $noscript; |
|---|
| 60 | |
|---|
| 61 | } |
|---|
| 62 | ]]></hook> |
|---|
| 63 | |
|---|
| 64 | <hook id="fn_message_start"><![CDATA[ |
|---|
| 65 | |
|---|
| 66 | if (strpos($_SERVER['SCRIPT_FILENAME'], 'extensions/ajax_post_edit/edit.php') !== false) |
|---|
| 67 | exit($message); |
|---|
| 68 | |
|---|
| 69 | ]]></hook> |
|---|
| 70 | |
|---|
| 71 | <hook id="fn_csrf_confirm_form_start"><![CDATA[ |
|---|
| 72 | |
|---|
| 73 | if (strpos($_SERVER['SCRIPT_FILENAME'], 'extensions/ajax_post_edit/edit.php') !== false) |
|---|
| 74 | exit('csrf_confirm:'.$lang_common['CSRF token mismatch'].':'.generate_form_token($ext_info['url'].'/edit.php')); |
|---|
| 75 | ]]></hook> |
|---|
| 76 | |
|---|
| 77 | </hooks> |
|---|
| 78 | </extension> |
|---|