Lines Matching refs:this

164 		$this->renderer   = $renderer;
165 $this->db = null;
166 $this->integrator = $integrator;
168 $this->renderer->nocache();
194 return $this->db;
210 if ( $this->integrator instanceof DokuWiki_Syntax_Plugin )
213 $value = $this->integrator->getConf( $name, null );
242 if ( $this->integrator instanceof DokuWiki_Syntax_Plugin )
243 return $this->integrator->getLang( $name );
247 if ( !is_array( $this->integrator ) )
257 $this->integrator = $lang;
262 return $this->integrator[$name];
281 if ( is_null( $this->table ) )
284 if ( is_null( $this->ioIndex ) )
285 $this->ioIndex = self::$ioIndices[$tableName]++;
287 return $this->ioIndex;
301 if ( !is_null( $this->explicitPageID ) )
302 return $this->explicitPageID;
321 $id = $this->getPageID();
338 $index = $this->getIndex();
358 $session =& $this->getSession();
376 $this->renderer->doc .= strval( $code );
414 foreach ( explode( "\n", $this->getConf( 'authSlots' ) ) as $line )
463 $this->db = new PDO( $dsn, $username, $password );
466 $this->db->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
469 $this->driver = strtolower( trim( $this->db->getAttribute(
473 if ( strpos( $this->driver, 'mysql' ) !== false )
478 $this->db->query( 'SET NAMES UTF8' );
482 $this->dsn = $dsn;
483 $this->authSlot = $authConfigSlot;
492 $this->render( sprintf( $this->getLang( 'nodblink' ), $e->getMessage() ) );
494 $this->db = $this->driver = null;
511 if ( is_null( $this->input ) )
514 $index = $this->getIndex();
516 $this->input = array();
523 if ( is_null( $this->input[$matches[1]] ) )
525 $this->input[$matches[1]] = is_array( $value ) ? $value[$index] : $value;
530 return $this->input;
544 if ( !is_array( $this->meta ) || empty( $this->meta ) )
549 $this->meta = $session['definition'];
553 throw new Exception( $this->getLang( 'nocolmeta' ) );
558 return $this->meta;
574 $this->getIndex() . ']';
597 if ( !$this->getConf( 'enableallpages' ) )
600 $patterns = explode( "\n", trim( $this->getConf( 'enablepages' ) ) );
603 $pageID = $this->getPageID();
625 $this->render( '<div class="database2-disabled">' .
626 $this->getLang( 'tagdisabled' ) . '</div>' );
639 throw new Exception( $this->getLang( 'restabnames' ) );
641 $this->table = $table;
644 $this->ioIndex = null; // drop to re-obtain new I/O index next
645 $index = $this->getIndex(); // but ensure to obtain at all ...
648 $this->options = is_array( $options ) ? $options : array();
650 if ( trim( $this->options['mayview'] ) === '' )
651 $this->options['mayview'] = '@ALL';
653 if ( trim( $this->options['mayinspect'] ) === '' )
654 $this->options['mayinspect'] = '@ALL';
656 $this->options['view'] = trim( $this->options['view'] );
657 if ( !$this->getConf( 'customviews' ) )
658 $this->options['view'] = '';
659 else if ( !preg_match( '/^SELECT\s/i', trim( $this->options['view'] ) ) )
660 $this->options['view'] = '';
662 $this->options['wikimarkup'] = self::asBool( $this->options['wikimarkup'] );
663 $this->options['simplenav'] = self::asBool( $this->options['simplenav'] );
665 if ( ctype_digit( trim( $this->options['rowsperpage'] ) ) )
668 $state =& $this->getSession();
670 $state['num'] = intval( $this->options['rowsperpage'] );
675 $this->parseDefinition( $code );
684 foreach ( $this->getInput() as $key => $dummy )
694 $rowACL = $this->getRowACL( $rowid );
701 $state =& $this->getSession();
707 if ( !$this->isAuthorizedMulti( $rowACL, $this->options, 'may'.$action ) )
710 $this->render( '<div class="error">' .
711 sprintf( $this->getLang( 'accessdenied' ),
712 $action, $this->table ) . '</div>' );
717 if ( ( $this->getSingleNumericPrimaryKey() !== false ) ||
734 if ( !$this->isAuthorizedMulti( $rowACL, $this->options, 'mayinspect' ) )
737 $this->render( '<div class="error">' .
738 sprintf( $this->getLang( 'accessdenied' ),
739 $action, $this->table ) . '</div>' );
756 $result = $this->editRecord( $rowid, $readonly,
778 $this->deleteRecord( $rowid );
782 $this->dropTable();
786 $method = array( &$this, '__handle_'.$action );
795 if ( !$this->exists( $this->table ) )
797 $this->createTable();
806 if ( $this->isAuthorized( $this->options['mayview'] ) )
808 $this->showTable( true, false, false, $this->options['view'] );
813 throw new Exception( sprintf( $this->getLang( 'badinteraction' ),
821 $this->render( '<div class="error">' .
822 sprintf( $this->getLang( 'deferror' ),
826 $resetCmd = $this->varname( 'cmdreset' );
827 $viewCmd = $this->varname( 'view' );
829 $btnSession = $this->getLang( 'btnResetSession' );
830 $btnTable = $this->getLang( 'btnViewTable' );
832 $this->render( $this->wrapInForm( <<<EOT
845 foreach ( $this->meta as $name => $def )
857 $session =& $this->getSession();
865 $aclName = $this->getACLCol();
866 $idColumn = $this->getSingleNumericPrimaryKey();
872 $this->table, $idColumn );
874 $st = $this->db->prepare( $sql );
876 throw new PDOException( $this->getLang( 'aclprepare' ) );
879 throw new PDOException( $this->getLang( 'aclexecute' ) );
900 $session =& $this->getSession();
916 if ( empty( $this->meta ) )
917 throw new Exception( $this->getLang( 'defmissing' ) );
921 $this->meta );
926 $sql = "CREATE TABLE {$this->table}\n(\n\t" . implode( ",\n\t", $cols ).
930 if ( $this->db->query( $sql ) === false )
931 throw new PDOException( sprintf( $this->getLang( 'nocreatetable' ),
932 $this->table ) );
935 $this->log( 'create', $this->table );
953 $ioIndex = $this->getIndex();
954 $input = $this->getInput();
955 $idColumn = $this->getSingleNumericPrimaryKey();
965 if ( $rowid && !$readOnly && !$this->obtainLock( $this->table, $rowid ) )
967 $this->render( '<div class="error">' . $this->getLang( 'reclocked' ) . '</div>' );
977 $state =& $this->getSession();
978 $store =& $this->getEditorSession();
1017 if ( $rowid && !$readOnly && !$this->releaseLock( $this->table, $rowid ) )
1018 $this->render( '<div class="error">' . $this->getLang( 'editnorelease' ) . '</div>' );
1034 foreach ( $this->meta as $column => $def )
1038 …$mayEdit = !$def['options']['mayedit'] || $this->isAuthorizedMulti( $rowACL, $def['options'], 'may…
1043 …$mayView = !$def['options']['mayview'] || $this->isAuthorizedMulti( $rowACL, $def['options'], 'may…
1052 $error = $this->checkValue( $rowid, $column, $input['data'.$column], $store[$column], $def );
1074 if ( !$this->db->beginTransaction() )
1075 $this->render( '<div class="error">' . $this->getLang( 'editnotransact' ) . '</div>' );
1083 if ( $this->meta[$column]['isColumn'] &&
1084 !is_string( $this->meta[$column]['options']['aliasing'] ) )
1087 $value = $this->valueToDB( $rowid, $column, $value, $this->meta[$column] );
1098 if ( !( $record[$idColumn] = $this->nextID( $this->table, true ) ) )
1099 throw new PDOException( $this->getLang( 'editnoid' ) );
1102 $this->table,
1118 $this->table, implode( ',', $assignments ),
1128 $st = $this->db->prepare( $sql );
1130 throw new PDOException( $this->getLang( 'editprepare' ) );
1133 throw new PDOException( $this->getLang( 'editexecute' ) );
1136 $this->log( $log[1], $this->table, $log[0] );
1139 if ( !$this->db->commit() )
1140 throw new PDOException( $this->getLang( 'editcommit' ) );
1148 if ( $rowid && !$readOnly && !$this->releaseLock( $this->table, $rowid, true ) )
1149 throw new PDOException( $this->getLang( 'editnorelease' ) );
1159 $this->render( '<div class="error">' .
1160 sprintf( $this->getLang( 'editcantsave' ),
1163 if ( !$this->db->rollBack() )
1164 $this->render( '<div class="error">' .
1165 $this->getLang( 'editrollback' ) .
1190 foreach ( $this->meta as $column => $def )
1192 $store[$column] = $this->getInitialValue( $column, $def );
1199 $cols = $this->__columnsList( false );
1203 if ( $this->options['view'] )
1205 $this->options['view'], $idColumn );
1208 $cols, $this->table, $idColumn );
1210 $st = $this->db->prepare( $sql );
1212 throw new PDOException( $this->getLang( 'editloadprepare' ) );
1215 throw new PDOException( $this->getLang( 'editloadexecute' ) );
1219 throw new PDOException( $this->getLang( 'notarecord' ) );
1231 … if ( !$this->isAuthorizedMulti( $rowACL, $this->meta[$name]['options'], 'mayview', null, true ) )
1234 $record[$name] = $this->getInitialValue( $column, $def );
1240 $store = $this->__sortRecord( $record );
1245 $store[$column] = $this->valueFromDB( $rowid, $column, $value, $this->meta[$column] );
1262 $input['____idx'] = $this->recordI2X( $rowid );
1266 $nav[] = array( 'P' . $this->recordX2I( $input['____idx'] - 1 ),
1267 $this->getLang( 'navprevious' ),
1270 $nextID = $this->recordX2I( $input['____idx'] + 1 );
1272 $nav[] = array( 'N' . $nextID, $this->getLang( 'navnext' ),
1276 array_unshift( $nav, array( 0, $this->getLang( 'navreturn' ) ) );
1292 $elements[] = $this->renderField( true, null, null, array(), null, $readOnly, $rowACL );
1295 $elements[] = $this->renderField( $rowid, $column, $value,
1296 $this->meta[$column],
1299 $elements[] = $this->renderField( false, $nav, null, array(), null, $readOnly, $rowACL );
1310 $this->render( $this->wrapInForm( implode( '', $elements ), array(
1311 $this->varname( 'cmd' . $cmdName ) => '1',
1312 $this->varname( '____single' ) => md5( $rowid ),
1313 $this->varname( '____idx' ) => $input['____idx'],
1339 $tabindex = $this->meta[$column]['options']['tabindex'];
1358 if ( $this->meta[$column]['isColumn'] )
1377 throw new Exception( $this->getLang( 'notarecord' ) );
1380 if ( !$this->db->beginTransaction() )
1381 throw new PDOException( $this->getLang( 'notransact' ) );
1386 if ( !$this->obtainLock( $this->table, $rowid, true, true ) )
1388 $this->render( '<div class="error">' . $this->getLang( 'reclocked' ) . '</div>' );
1389 $this->db->rollback();
1394 $idColumn = $this->getSingleNumericPrimaryKey();
1396 $st = $this->db->prepare( 'DELETE FROM ' . $this->table . ' WHERE '.
1399 throw new PDOException( $this->getLang( 'delprepare' ) );
1402 throw new PDOException( $this->getLang( 'delexecute' ) );
1404 $this->log( 'delete', $this->table, $rowid );
1407 if ( !$this->db->commit() )
1408 throw new PDOException( $this->getLang( 'delcommit' ) );
1414 $this->db->rollback();
1430 if ( !$this->db->beginTransaction() )
1431 throw new PDOException( $this->getLang( 'notransact' ) );
1436 if ( !$this->obtainLock( $this->table, null, true, true ) )
1438 $this->render( '<div class="error">' . $this->getLang( 'tablelocked' ) . '</div>' );
1439 $this->db->rollback();
1444 if ( $this->db->query( 'DROP TABLE ' . $this->table ) === false )
1445 throw new PDOException( sprintf( $this->getLang( 'nodrop' ), $this->table ) );
1447 $this->log( 'drop', $this->table );
1450 if ( !$this->db->commit() )
1451 throw new PDOException( $this->getLang( 'dropcommit' ) );
1457 $this->db->rollback();
1477 $meta = $this->getColumnsMeta();
1479 $idCol = $this->getSingleNumericPrimaryKey();
1531 list( $filter, $parameters ) = $this->getFilter();
1536 $query = "SELECT COUNT(*) FROM {$this->table}";
1550 $st = $this->db->prepare( $query . $filter );
1552 throw new PDOException( $this->getLang( 'countprepare' ) );
1555 throw new PDOException( $this->getLang( 'countexecute' ) );
1585 $config = $this->__configureSelect();
1648 $query = 'SELECT ' . $columns . ' FROM ' . $this->table;
1664 $st = $this->db->prepare( $query . $filter . $order . $limit );
1666 throw new PDOException( $this->getLang( 'listprepare' ) );
1669 throw new PDOException( $this->getLang( 'listexecute' ) );
1695 $meta = $this->getColumnsMeta( ( $customQuery !== '' ) );
1703 $count = $this->__recordsCount( $customQuery );
1711 $state =& $this->getSession();
1714 $state['sort'] = $this->options['sort'];
1726 $input = $this->getInput();
1778 $cols = $this->__columnsList( true, $isPrintVersion );
1779 $rows = $this->__recordsList( $cols, true, $skip, $num, $customQuery );
1782 $idCol = $this->getSingleNumericPrimaryKey();
1783 $code = $this->__renderTable( $idCol, $cols, $rows, $count, $num,
1790 $this->render( $code );
1839 if ( $this->options['aclColumn'] )
1841 $rowACL = $row[$this->options['aclColumn']];
1842 if ( $meta[$this->options['aclColumn']]['options']['visible'] === 1 )
1843 unset( $row[$this->options['aclColumn']] );
1869 $value = $this->valueFromDB( $rowid, $column, $value, $def );
1871 $cell = $this->renderValue( $rowid, $column, $value, $def,
1878 if ( $this->options['view'] ||
1879 !$this->isAuthorizedMulti( $rowACL, $this->options,
1884 if ( $this->isAuthorizedMulti( $rowACL, $this->options,
1888 $this->varname( 'cmd' . $clickAction, $rowid ) .
1895 $cell = $this->convertToLink( $clickAction, $cell,
1910 $this->getRecordCommands( $rowid, $rowACL, $clicks ) .
1994 $label = $this->convertToLink( $href, $label );
2001 $title = $this->getLang( 'hintsortasc' );
2007 $title = $this->getLang( 'hintsortdesc' );
2013 $title = $this->getLang( 'hintsortasc' );
2018 'type="image" name="' . $this->varname( 'sort' . $name ).
2037 if ( $this->isAuthorized( $this->options['mayfilter'] ) && $expectInput )
2040 $filter = $this->renderFilter();
2054 …list( $flipDown, $flipUp, $pages, $sizes, $stat ) = $this->getPagerElements( $skip, $num, $count );
2067 $globalCmds = $expectInput ? $this->getGlobalCommands() : '';
2074 $width = intval( $this->options['width'] ) ? ' width="' . $this->options['width'] . '"' : '';
2077 $trClass = $this->options['wikistyle'] ? '' : ' class="data-list"';
2078 $tableClass = $this->options['wikistyle'] ? ' class="inline"' : '';
2141 return $expectInput ? $this->wrapInForm( $table ) : $table;
2170 return '<input type="submit" name="' . $this->varname( $name ) .
2186 return '<input type="image" name="' . $this->varname( $name ) .
2250 $backward[] = $this->imgbutton( 'skip0', $this->getLang( 'hintflipfirst' ), 'first' );
2253 …$backward[] = $this->imgbutton( 'skip' . $skips[$page-1], $this->getLang( 'hintflipprevious' ), 'p…
2260 $pages[] = $this->button( 'skip' . $skips[$i], $i + 1,
2274 …$forward[] = $this->imgbutton( 'skip' . $skips[$page+1], $this->getLang( 'hintflipnext' ), 'next' …
2277 …$forward[] = $this->imgbutton( 'skip' . ( $count - $num ), $this->getLang( 'hintfliplast' ), 'last…
2286 $stat = sprintf( $this->getLang( 'recnumsingle' ), $count );
2288 $stat = sprintf( $this->getLang( 'recnummulti' ), $count );
2290 $stat = sprintf( $this->getLang( 'recnummultipage' ), $count, count( $skips ) );
2296 $sizes[] = $this->button( 'num' . $size, $size,
2331 $this->table . '_' . $this->getIndex();
2341 $form->addHidden( 'id', $this->getPageID() );
2460 $rowACL = $this->parseACLRule( $rowACL, false, true );
2471 return $this->isAuthorized( $rule );
2488 return $this->isAuthorized( $rule );
2502 if ( $this->options['view'] )
2507 'insert' => array( 'add', $this->getLang( 'cmdadd' ) ),
2508 'drop' => array( 'drop', $this->getLang( 'cmddrop' ), true ),
2509 'print' => array( 'print', $this->getLang( 'cmdprint' ), 'print', true, 'print' ),
2510 'export.csv' => array( 'exportcsv', $this->getLang( 'cmdcsv' ), 'csv' ),
2512 'viewlog' => array( 'exportlog', $this->getLang( 'cmdlog' ), 'log' ),
2516 if ( !$this->getSingleNumericPrimaryKey() )
2521 if ( $this->isAuthorized( $this->options['may'.($authz=strtok( $name, '.' ))] ) )
2527 $href = $this->attachmentLink( $def[2], $authz, !$def[3] );
2537 $this->varname( 'cmd' . $name ) .
2540 …'.gif" onclick="' . ( $def[2] ? "return confirm('" . $this->getLang( 'confirmdrop' ) . "');" : '' …
2570 if ( !$this->getSingleNumericPrimaryKey() )
2575 'inspect' => array( 'view', $this->getLang( 'cmdview' ) ),
2576 'edit' => array( 'edit', $this->getLang( 'cmdedit' ) ),
2577 'insert' => array( 'copy', $this->getLang( 'cmdcopy' ) ),
2579 'delete' => array( 'delete', $this->getLang( 'cmddelete' ), true ),
2583 if ( $this->options['view'] )
2593 if ( $this->isAuthorizedMulti( $rowACL, $this->options, 'may' . $name ) )
2596 $idName = $this->varname( 'cmd' . $name, $rowid );
2598 $this->options['addonclick'] ) ? '' : ' hidden';
2604 …'.gif" onclick="' . ( $def[2] ? "return confirm('" . $this->getLang( 'confirmdelete' ) . "');" : '…
2619 $idCol = $this->getSingleNumericPrimaryKey();
2628 list( $filter, $parameters ) = $this->getFilter();
2632 $state =& $this->getSession();
2644 if ( $this->meta[$col]['isColumn'] )
2647 if ( is_string( $this->meta[$col]['options']['aliasing'] ) )
2648 $cols[] = $this->meta[$col]['options']['aliasing'] . ' AS ' . $col;
2671 $config = $this->__configureSelect();
2679 $st = $this->db->prepare( 'SELECT ' . implode( ',', $cols ) .
2680 ' FROM ' . $this->table . $filter . $order );
2682 throw new PDOException( $this->getLang( 'listprepare' ) );
2685 throw new PDOException( $this->getLang( 'listexecute' ) );
2711 $config = $this->__configureSelect();
2719 $st = $this->db->prepare( 'SELECT ' . implode( ',', $cols ) .
2720 ' FROM ' . $this->table . $filter . $order .
2723 throw new PDOException( $this->getLang( 'listprepare' ) );
2726 throw new PDOException( $this->getLang( 'listexecute' ) );
2768 $argument = $this->parseString( $tail, $pos );
2787 'arg' => $this->replaceMarkup( $argument ),
2828 $input = $this->getInput();
2829 $session =& $this->getSession();
2842 if ( $this->options['basefilter'] )
2844 return ( $session['search'] = $this->parseFilterCode( $this->options['basefilter'] ) );
2893 $filters = $this->getFilterInput();
2908 $meta = $this->getColumnsMeta();
2981 $meta = $this->getColumnsMeta();
3036 'like' => array( $this->getLang( 'oplike' ), 'text', ),
3037 'nlike' => array( $this->getLang( 'opnotlike' ), 'text', ),
3044 'isset' => array( $this->getLang( 'opset' ), 'bool', ),
3045 'isclear' => array( $this->getLang( 'opclear' ), 'bool', ),
3068 $filters = $this->getFilterInput();
3069 $input = $this->getInput();
3072 'AND' => '<span class="mode-and">' . $this->getLang( 'opand' ) . '</span>',
3073 'OR' => '<span class="mode-or">' . $this->getLang( 'opor' ) . '</span>',
3091 $session =& $this->getSession();
3118 $colname = $this->varname( 'searchcol' . $index );
3119 $opname = $this->varname( 'searchop' . $index );
3120 $argname = $this->varname( 'searcharg' . $index );
3143 $cmds[] = $this->imgbutton( 'searchgo', $this->getLang( 'cmdfilterapply' ), 'filter' );
3144 $cmds[] = $this->imgbutton( 'searchand', $this->getLang( 'cmdfilterintersect' ), 'filter-and' );
3145 $cmds[] = $this->imgbutton( 'searchor', $this->getLang( 'cmdfilterunion' ), 'filter-or' );
3149 $cmds[] = $this->imgbutton( 'searchdrop', 'Reset filter',
3453 $href = $this->replaceMarkup( $href, $varspace );
3462 $length = strlen( $this->renderer->doc );
3464 $this->renderer->externallink( $href, $label );
3467 $label = substr( $this->renderer->doc, $length );
3468 $this->renderer->doc = substr_replace( $this->renderer->doc, '',
3477 $label = $this->renderer->internallink( $href, $label, NULL, true );
3516 $parsed = $this->splitDefinitionLine( $line );
3518 throw new Exception( sprintf( $this->getLang( 'definline' ), $index ) );
3532 throw new Exception( sprintf( $this->getLang( 'defdouble' ), $colName ) );
3589 throw new Exception( $this->getLang( 'invalidbool' ) );
3602 throw new Exception( $this->getLang( 'noaliased' ) );
3649 if ( $this->options['view'] )
3742 throw new Exception( $this->getLang( 'multiacl' ) );
3787 throw new Exception( $this->getLang( 'emptyenum' ) );
3800 if ( !$this->getConf( 'customviews' ) )
3801 throw new Exception( $this->getLang( 'readerdisabled' ) );
3803 throw new Exception( $this->getLang( 'invalidreader' ) );
3809 $resultset = $this->db->query( $readerSQL );
3815 throw new Exception( $this->getLang( 'invalidreader' ) );
3827 throw new Exception( $this->getLang( 'emptyenum' ) );
3838 throw new Exception( sprintf( $this->getLang( 'badtype' ),
3850 else if ( $this->driver == 'mssql' )
3862 $sqldef = ( $this->driver == 'sqlite' ) ? 'real'
3887 if ( $this->getConf( 'aliasing' ) ||
3902 $failed[] = sprintf( $this->getLang( 'baddef' ),
3913 throw new Exception( $this->getLang( 'emptydef' ) );
3987 $this->meta = $out;
3990 $session['definition'] = $this->meta;
3999 $this->options['aclColumn'] = $aclColumn;
4051 if ( !$this->meta )
4054 if ( $this->meta['.PRIMARY_KEYS'] )
4055 return $this->meta['.PRIMARY_KEYS']['primaries'];
4075 $primaries = $this->getPrimaryKeyColumns();
4082 if ( isset( $this->meta[$column]['type'] ) )
4083 if ( $this->meta[$column]['type'] != 'integer' )
4111 $s = $this->db->query( $sql );
4155 if ( !$this->exists( '__keys' ) )
4156 if ( $this->db->query( <<<EOT
4163 throw new PDOException( $this->getLang( 'idnotable' ) );
4167 if ( !$nestedTransaction && !$this->db->beginTransaction() )
4168 throw new PDOException( $this->getLang( 'notransact' ) );
4174 $st = $this->db->prepare('SELECT recent FROM __keys WHERE tablename=?');
4176 throw new PDOException( $this->getLang( 'idreadprepare' ) );
4179 throw new PDOException( $this->getLang( 'idreadexecute' ) );
4200 $st = $this->db->prepare( $sql );
4202 throw new PDOException( $this->getLang( 'idwriteprepare' ) );
4205 throw new PDOException( $this->getLang( 'idwriteexecute' ) );
4209 if ( !$nestedTransaction && !$this->db->commit() )
4210 throw new PDOException( $this->getLang( 'idcommit' ) );
4219 if ( !$nestedTransaction && !$this->db->rollBack() )
4220 throw new PDOException( $this->getLang( 'idrollback' ) );
4222 throw new Exception( $this->getLang( 'idnoid' ) );
4245 throw new Exception( $this->getLang( 'userunknown' ) );
4273 if ( !$this->exists( '__log' ) )
4274 if ( $this->db->query( <<<EOT
4284 throw new PDOException( $this->getLang( 'lognotable' ) );
4289 $st = $this->db->prepare( 'INSERT INTO __log (tablename,rowid,action,' .
4292 throw new PDOException( $this->getLang( 'logprepare' ) );
4296 throw new PDOException( $this->getLang( 'logexecute' ) );
4300 if ( $this->driver == 'sqlite' )
4301 $this->db->query( 'DELETE FROM __log WHERE ctime<'.(time()-30*86400));
4329 if ( !$this->exists( '__locks' ) )
4330 if ( $this->db->query( <<<EOT
4351 if ( !$inTransaction && !$this->db->beginTransaction() )
4364 if ( !$this->obtainLock( $table, null, true, true, true ) )
4365 throw new PDOException( $this->getLang( 'locksuperlocked' ) );
4373 $st = $this->db->prepare( 'SELECT COUNT(*) FROM __locks ' .
4377 throw new PDOException( $this->getLang( 'locksubprepare' ) );
4380 throw new PDOException( $this->getLang( 'locksubexecute' ) );
4385 throw new PDOException( $this->getLang( 'locksublocked' ) );
4395 $st = $this->db->prepare( 'SELECT username,obtained FROM __locks ' .
4398 throw new PDOException( $this->getLang( 'lockreadprepare' ) );
4401 throw new PDOException( $this->getLang( 'lockreadexecute' ) );
4416 if ( time() - intval( $lock[1] ) < $this->getConf( 'locktime' ) )
4418 throw new PDOException( $this->getLang( 'locklocked' ) );
4435 $st = $this->db->prepare( $sql );
4437 throw new PDOException( $this->getLang( 'lockwriteprepare' ) );
4440 throw new PDOException( $this->getLang( 'lockwriteexecute' ) );
4445 if ( !$inTransaction && !$this->db->commit() )
4446 throw new PDOException( $this->getLang( 'lockcommit' ) );
4454 if ( !$inTransaction && !$this->db->rollBack() )
4455 throw new PDOException( $this->getLang( 'lockrollback' ) );
4481 if ( !$this->exists( '__locks' ) )
4494 if ( !$inTransaction && !$this->db->beginTransaction() )
4500 if ( !$this->obtainLock( $table, $rowid, true, true, true ) )
4506 $st = $this->db->prepare( 'DELETE FROM __locks WHERE tablename=? AND ' .
4509 throw new PDOException( $this->getLang( 'releaseprepare' ) );
4512 throw new PDOException( $this->getLang( 'releaseexecute' ) );
4515 if ( !$inTransaction && !$this->db->commit() )
4516 throw new PDOException( $this->getLang( 'releasecommit' ) );
4525 if ( !$inTransaction && !$this->db->rollBack() )
4526 throw new PDOException( $this->getLang( 'releaserollback' ) );
4553 if ( !$rowid || ( $this->meta[$column]['type'] != 'data' ) )
4554 throw new Exception( sprintf( $this->getLang( 'medianomedia' ), $column ) );
4557 $idColumn = $this->getSingleNumericPrimaryKey();
4560 throw new Exception( $this->getLang( 'mediana' ) );
4564 $session =& $this->getSession();
4571 $selector = array( '@'.$this->dsn, $this->authSlot, $this->table,
4572 $column, $idColumn, $rowid, $this->getPageID(),
4573 $this->getIndex(), self::currentUser(),
4581 if ( !$this->isAuthorizedMulti( $rowACL, $this->options, 'maydownload', 'mayview', true ) )
4586 throw new Exception( $this->getLang( 'mediadenied' ) );
4623 $session =& $this->getSession();
4630 $selector = array( '@'.$this->dsn, $this->authSlot, $this->table,'fake',
4631 'id', 1, $this->getPageID(), $this->getIndex(),
4639 if ( !$this->isAuthorizedMulti( $rowACL, $this->options, 'may' . $authorization ) )
4644 throw new Exception( $this->getLang( 'mediadenied' ) );
4678 $session =& $this->getEditorSession();
4681 throw new Exception( $this->getLang( 'medianoeditor' ) );
4685 $selector = array( $this->getPageID(), $this->getIndex(), $column );
4831 throw new Exception( $this->getLang( 'badaclrule' ) );
4846 throw new Exception( $this->getLang( 'badaclrule' ) );
4894 return $this->getPageID();
4907 if ( is_array( $this->__replaceMarkupVarspace ) )
4910 if ( isset( $this->__replaceMarkupVarspace[$keyword] ) )
4911 return $this->__replaceMarkupVarspace[$keyword];
4913 if ( isset( $this->__replaceMarkupVarspace[$group][$arg] ) )
4914 $this->__replaceMarkupVarspace[$group][$arg];
4940 $this->__replaceMarkupVarspace = $varspace;
4942 $in = preg_replace_callback( '/%{([^}]+)}/', array( &$this,
4970 $default = $this->replaceMarkup( trim( $def['options']['default'] ) );
5008 return $this->inputToInternal( $default, $def );
5186 throw new Exception( $this->getLang( 'fileinvalid' ) );
5249 $this->dropRowACL( $rowid );
5315 $idx = $this->getIndex();
5332 return sprintf( $this->getLang( 'filebadupload' ), $in['error'] );
5335 return $this->getLang( 'filenoupload' );
5341 return $this->getLang( 'filebadmime' );
5350 return $this->getLang( 'filenoimage' );
5357 return $this->getLang( 'fileincomplete' );
5372 return $this->getLang( 'markrequired' );
5402 return $this->getLang( 'badenum' );
5412 return $this->getLang( 'badenum' );
5421 return $this->getLang( 'badenum' );
5428 return $this->getLang( 'badenum' );
5443 $value = $this->inputToInternal( $value, $def );
5449 throw new Exception( $this->getLang( 'required' ) );
5486 throw new Exception( $this->getLang( 'badinteger' ) );
5497 else if ( in_array( $value, array( $this->getLang( 'today' ), $this->getLang( 'now' ) ) ) )
5504 throw new Exception( $this->getLang( 'baddate' ) );
5516 if ( $value == $this->getLang( 'now' ) )
5519 throw new Exception( $this->getLang( 'badtime' ) );
5531 else if ( $value === $this->getLang( 'now' ) )
5543 throw new Exception( $this->getLang( 'baddatetime' ) );
5545 throw new Exception( $this->getLang( 'baddatetimetail' ) );
5547 if ( trim( $date ) === $this->getLang( 'today' ) )
5559 throw new Exception( $this->getLang( 'baddate' ) );
5564 throw new Exception( $this->getLang( 'badtime' ) );
5583 throw new Exception( $this->getLang( 'badphonefax' ) );
5599 throw new Exception( $this->getLang( 'badmoney' ) );
5609 throw new Exception( $this->getLang( 'badmoneytail' ) );
5625 throw new Exception( $this->getLang( 'badfloat' ) );
5640 throw new Exception( $this->getLang( 'badurl' ) );
5642 throw new Exception( $this->getLang( 'badurlnoabs' ) );
5656 throw new Exception( $this->getLang( 'badmail' ) );
5658 if ( $this->getConf( 'checkmaildomains' ) != false )
5665 throw new Exception( $this->getLang( 'badmailunknown' ) );
5676 if ( $this->isAuthorized( $this->options['mayadmin'] ) )
5677 $value = implode( ';', $this->parseACLRule( trim( $value ), true ) );
5732 if ( $readOnly && $this->input['optnoctl'] )
5745 $this->varname( '____save' ) .
5746 '" value="' . $this->getLang( 'cmdsave' ) . '" />';
5748 if ( is_array( $column ) && count( $column ) && !$this->options['simplenav'] )
5756 $mode = '<select name="' . $this->varname( '____nav' ) .
5759 $name = $this->getLang( 'cmdokay' );
5765 $name = $this->getLang( 'cmdreturn' );
5770 $this->varname( '____cancel' ) .
5771 …'" value="' . ( $readOnly ? $name : ( $mode ? $this->getLang( 'cmdnosave' ) : $this->getLang( 'cmd…
5801 $code = $this->renderValue( $rowid, $column, $value, $def, true, true, $rowACL );
5820 $mayView = $this->isAuthorizedMulti( $rowACL, $def['options'], 'mayview', null, true );
5823 if ( !$this->isAuthorizedMulti( $rowACL, $def['options'], 'mayedit' ) )
5824 return $this->renderField( $rowid, $column, $value, $def, '', true, $rowACL );
5837 $name = $this->varname( 'data' . $column );
5858 $code = '<span class="disabled">' . $this->getLang( 'fileexternal' ) . '</span>';
5862 $current = $this->renderValue( $rowid, $column, $value, $def, true, true, $rowACL );
5864 …submit\" name=\"$name\" value=\"" . $this->getLang( 'cmddropfile' ) . "\" onclick=\"return confirm…
5872 if ( !$this->isAuthorized( $this->options['mayadmin'] ) )
5910 … array_unshift( $options, '<option value="">' . $this->getLang( 'enumunselected' ) . '</option>' );
5922 $value = strftime( strtok( trim( $this->getConf( 'dformat' ) ), ' ' ), intval( $value ) );
5929 $value = strftime( $this->getConf( 'dformat' ), intval( $value ) );
5952 'date' => strlen( strftime( $this->getConf( 'dformat' ) ) ),
5953 'datetime' => strlen( strftime( $this->getConf( 'dformat' ) ) ),
6011 if ( !$this->isAuthorizedMulti( $rowACL, $def['options'], 'mayview', null, true ) )
6012 return $mayBeSkipped ? null : '<em>' . $this->getLang( 'hidden' ) . '</em>';
6025 if ( $this->options['wikimarkup'] || $def['options']['wikimarkup'] )
6037 $value = $this->stripTags( $value );
6044 return '<span class="info">' . $this->getLang( 'fileexternalfound' ) . '</span>';
6046 return '<span class="info">' . $this->getLang( 'fileexternalnotfound' ) . '</span>';
6053 return $mayBeSkipped ? null : '<em>' . $this->getLang( 'none' ) . '</em>';
6056 $url = $this->editorSessionMediaLink( $column, ( $def['format'] != 'image' ) );
6058 $url = $this->mediaLink( $rowid, $column, ( $def['format'] != 'image' ) );
6064 …return "<img src=\"$url\" alt=\"" . sprintf( $this->getLang( 'fileimagealt' ), $column, $value['mi…
6066 $mayDownload = $this->isAuthorizedMulti( $rowACL, $this->options, 'maydownload' );
6068 return '<em>' . $this->getLang( 'filedenied' ) . '</em>';
6071 $this->getLang( 'filedlhint' ) . '">' .
6072 $this->getLang( 'cmddl' ) . '</a>';
6105 return strftime( strtok( trim( $this->getConf( 'dformat' ) ), ' ' ), $value );
6111 return strftime( $this->getConf( 'dformat' ), $value );
6136 if ( !$this->isAuthorized( $this->options['mayadmin'] ) )
6155 $this->renderer = '';
6156 $this->integrator = $integrator;
6174 $this->renderer .= $code;
6180 return $this->renderer;
6186 return $this->db;