'on', 'auth' => '', 'table' => '', ); $auth_chk = auth::check_auth(); foreach($edit_auth_pages as $key=>$val){ if (preg_match($key, $page)){ $opt['edit'] = 'off'; if(! empty($auth_chk)){ $opt['edit'] = 'on'; } } } // if(is_editable($page)){ } $body = ''; $body2 = ''; $args = func_get_args(); $arg = array_pop($args); foreach ($args as $opt_key) { list($key, $val) = explode('=', strtolower($opt_key)); $opt[$key] = htmlspecialchars($val); } // if (PKWK_READONLY) { if (auth::check_role('readonly') || is_freeze($page)) { $opt['edit'] = 'off'; } $arg = preg_replace(array("[\\r|\\n]","[\\r]"), array("\n","\n"), $arg); $args = explode("\n", $arg); // $args_count = count($args); foreach ($args as $args_line) { if (preg_match('/^\|(.+)\|([hHfFcC]?)$/', $args_line, $matches) && $opt['edit'] != 'off'){ // if ($matches[2] == "c") { //C off : c on // $matches[2] = "h"; // $body .= '|' . $matches[1] . "|RIGHT:|c\n"; // } $body .= '|' . $matches[1] . "|[[edit:" . $script . "?plugin=table_edit2&refer=$r_page&edit_mod=show&table_num=" . $count . "&line_count=" . $line_count . "]][[add:" . $script . "?plugin=table_edit2&refer=$r_page&edit_mod=tr&table_num=" . $count . "&line_count=" . $line_count . "]]|" . $matches[2] . "\n"; $line_count++; } else { $body .= $args_line . "\n"; } } return convert_html($body); } function plugin_table_edit2_action() { global $vars, $post, $script; $line_count = 1; $table_num = $vars['table_num']; $page = $vars['refer']; if (auth::check_role('readonly')) die_message('PKWK_READONLY prohibits editing'); $args = get_source($page); static $count = 0; $source_s = ''; $body = ''; $title = ''; foreach ($args as $args_line) { // if (preg_match('/^#table_edit2([^\(\{]+)(?:\(([^\r]*)\))?(\{*)/', $args_line, $matches)){ //2 if(preg_match('/^#([^\(\{]+)(?:\(([^\r]*)\))?(\{*)/', $args_line, $matches) && $matches[1] == 'table_edit2') { $table_find = 1; $count++; if( $line_count === 1 && $count == $table_num ){ if(! preg_match('/(auth_check_off)/i',$matches[2])){ check_editable($page, true, true); } } $end_line = strlen($matches[3]); } if (preg_match('/^\}{' . $end_line . '}/', $args_line)) { $table_find = 0; } if($table_find && $table_num == $count){ if (preg_match('/^\|(.+)\|([hHfFcC]?)$/', $args_line, $match_line)){ if($vars['edit_mod'] == 'show'){ //show if($line_count === 1){ if( strtolower( $match_line[2] ) == 'c' ){ $line_header = 2; } else { $line_header = 1; } } if($line_count === $line_header){ $match_t = explode("|", $match_line[1]); $cell_count = 1; foreach ($match_t as $cell){ $table_header[$cell_count] = $cell; $cell_count++; } } } if($vars['line_count'] == $line_count){ if($vars['edit_mod'] == 't_edit'){ //t_edit $source_s .= '|'; for ($i = 1;$i < $vars['cell_count'];$i++){ $source_s .= $vars['cell' . $i] . '|'; } $source_s .= $match_line[2] . ' '; } if($vars['edit_mod'] == 'tr'){ //tr $source_s .= $args_line; $match_t = explode("|", $match_line[1]); $source_s .= '|'; foreach ($match_t as $cell){ $source_s .= '|'; } $source_s .= $match_line[2] . ' '; } if($vars['edit_mod'] == 'show'){ //show $match_t = explode("|", $match_line[1]); $title = 'table_edit2 ' . $page; $body = '