gehe zum Quellcode dieser Datei
Namensbereiche | |
| namespace | Joomla |
Funktionen | |
| cancel ($option) | |
| changeAccess ($id, $access, $option) | |
| changeState ($cid=null, $state=0, $option) | |
| edit ($uid, $option) | |
| go2menu () | |
| go2menuitem () | |
| menuLink ($option, $id) | |
| resethits ($option, $id) | |
| save ($option, $task) | |
| saveOrder (&$cid) | |
| trash (&$cid, $option) | |
| view ($option) | |
Variablen | |
| $cid = josGetArrayInts( 'cid' ) | |
| case | $option |
| case | $task |
| case | __pad0__ |
| case | __pad10__ |
| default | __pad11__ |
| case | __pad1__ |
| case | __pad2__ |
| case | __pad3__ |
| case | __pad4__ |
| case | __pad5__ |
| case | __pad6__ |
| case | __pad7__ |
| case | __pad8__ |
| case | __pad9__ |
| break | |
| cancel | ( | $ | option | ) |
Cancels an edit operation
Definiert in Zeile 546 der Datei admin.typedcontent.php.
Benutzt $database, $option, $row, josSpoofCheck() und mosRedirect().
Wird benutzt von HTML_content::editContent(), HTML_weblinks::editWeblink() und HTML_user::userEdit().
00546 { 00547 global $database; 00548 00549 josSpoofCheck(); 00550 00551 $row = new mosContent( $database ); 00552 $row->bind( $_POST ); 00553 $row->checkin(); 00554 mosRedirect( 'index2.php?option='. $option ); 00555 }


| changeAccess | ( | $ | id, | |
| $ | access, | |||
| $ | option | |||
| ) |
changes the access level of a record
| integer | The increment to reorder by |
Definiert in Zeile 501 der Datei admin.typedcontent.php.
Benutzt $access, $database, $id, $option, $row, mosCache::cleanCache(), josSpoofCheck() und mosRedirect().
00501 { 00502 global $database; 00503 00504 josSpoofCheck(); 00505 00506 $row = new mosContent( $database ); 00507 $row->load( (int)$id ); 00508 $row->access = $access; 00509 00510 if ( !$row->check() ) { 00511 return $row->getError(); 00512 } 00513 if ( !$row->store() ) { 00514 return $row->getError(); 00515 } 00516 00517 // clean any existing cache files 00518 mosCache::cleanCache( 'com_content' ); 00519 00520 mosRedirect( 'index2.php?option='. $option ); 00521 }

| changeState | ( | $ | cid = null, |
|
| $ | state = 0, |
|||
| $ | option | |||
| ) |
Changes the state of one or more content pages
| string | The name of the category section | |
| integer | A unique category id (passed from an edit form) | |
| array | An array of unique category id numbers | |
| integer | 0 if unpublishing, 1 if publishing | |
| string | The name of the current user |
Definiert in Zeile 455 der Datei admin.typedcontent.php.
Benutzt $cid, $database, $msg, $my, $option, $query, $row, $total, mosCache::cleanCache(), josSpoofCheck(), mosArrayToInts() und mosRedirect().
00455 { 00456 global $database, $my; 00457 00458 josSpoofCheck(); 00459 00460 if (count( $cid ) < 1) { 00461 $action = $state == 1 ? 'publish' : ($state == -1 ? 'archive' : 'unpublish'); 00462 echo "<script> alert('Select an item to $action'); window.history.go(-1);</script>\n"; 00463 exit; 00464 } 00465 00466 mosArrayToInts( $cid ); 00467 $total = count ( $cid ); 00468 $cids = 'id=' . implode( ' OR id=', $cid ); 00469 00470 $query = "UPDATE #__content" 00471 . "\n SET state = " . (int) $state 00472 . "\n WHERE ( $cids )" 00473 . "\n AND ( checked_out = 0 OR ( checked_out = " . (int) $my->id . " ) )" 00474 ; 00475 $database->setQuery( $query ); 00476 if (!$database->query()) { 00477 echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n"; 00478 exit(); 00479 } 00480 00481 if (count( $cid ) == 1) { 00482 $row = new mosContent( $database ); 00483 $row->checkin( $cid[0] ); 00484 } 00485 00486 // clean any existing cache files 00487 mosCache::cleanCache( 'com_content' ); 00488 00489 if ( $state == "1" ) { 00490 $msg = $total ." Item(s) successfully Published"; 00491 } else if ( $state == "0" ) { 00492 $msg = $total ." Item(s) successfully Unpublished"; 00493 } 00494 mosRedirect( 'index2.php?option='. $option .'&msg='. $msg ); 00495 }

| edit | ( | $ | uid, | |
| $ | option | |||
| ) |
Compiles information to add or edit content
| database | A database connector object | |
| string | The name of the category section | |
| integer | The unique id of the category to edit (0 if new) |
Definiert in Zeile 200 der Datei admin.typedcontent.php.
Benutzt $and, $database, $images, $mainframe, $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_offset, $my, $nullDate, $option, $params, $pos, $query, $row, HTML_typedcontent::edit(), GetImageFolders(), GetImages(), GetSavedImages(), mosHTML::makeOption(), mosErrorAlert(), mosFormatDate() und mosHTML::selectList().
Wird benutzt von HTML_menusections::showMenusections().
00200 { 00201 global $database, $my, $mainframe; 00202 global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_offset; 00203 00204 $row = new mosContent( $database ); 00205 $row->load( (int)$uid ); 00206 00207 $lists = array(); 00208 $nullDate = $database->getNullDate(); 00209 00210 if ($uid) { 00211 // fail if checked out not by 'me' 00212 if ($row->isCheckedOut( $my->id )) { 00213 mosErrorAlert( "The module ".$row->title." is currently being edited by another administrator" ); 00214 } 00215 00216 $row->checkout( $my->id ); 00217 00218 if (trim( $row->images )) { 00219 $row->images = explode( "\n", $row->images ); 00220 } else { 00221 $row->images = array(); 00222 } 00223 00224 $row->created = mosFormatDate( $row->created, _CURRENT_SERVER_TIME_FORMAT ); 00225 $row->modified = $row->modified == $nullDate ? '' : mosFormatDate( $row->modified, _CURRENT_SERVER_TIME_FORMAT ); 00226 $row->publish_up = mosFormatDate( $row->publish_up, _CURRENT_SERVER_TIME_FORMAT ); 00227 00228 if (trim( $row->publish_down ) == $nullDate || trim( $row->publish_down ) == '' || trim( $row->publish_down ) == '-' ) { 00229 $row->publish_down = 'Never'; 00230 } 00231 $row->publish_down = mosFormatDate( $row->publish_down, _CURRENT_SERVER_TIME_FORMAT ); 00232 00233 $query = "SELECT name" 00234 . "\n FROM #__users" 00235 . "\n WHERE id = " . (int) $row->created_by 00236 ; 00237 $database->setQuery( $query ); 00238 $row->creator = $database->loadResult(); 00239 00240 // test to reduce unneeded query 00241 if ( $row->created_by == $row->modified_by ) { 00242 $row->modifier = $row->creator; 00243 } else { 00244 $query = "SELECT name" 00245 . "\n FROM #__users" 00246 . "\n WHERE id = " . (int) $row->modified_by 00247 ; 00248 $database->setQuery( $query ); 00249 $row->modifier = $database->loadResult(); 00250 } 00251 00252 // get list of links to this item 00253 $and = "\n AND componentid = " . (int) $row->id; 00254 $menus = mosAdminMenus::Links2Menu( 'content_typed', $and ); 00255 } else { 00256 // initialise values for a new item 00257 $row->version = 0; 00258 $row->state = 1; 00259 $row->images = array(); 00260 $row->publish_up = date( 'Y-m-d H:i:s', time() + ( $mosConfig_offset * 60 * 60 ) ); 00261 $row->publish_down = 'Never'; 00262 $row->sectionid = 0; 00263 $row->catid = 0; 00264 $row->creator = ''; 00265 $row->modified = $nullDate; 00266 $row->modifier = ''; 00267 $row->ordering = 0; 00268 $menus = array(); 00269 } 00270 00271 // calls function to read image from directory 00272 $pathA = $mosConfig_absolute_path .'/images/stories'; 00273 $pathL = $mosConfig_live_site .'/images/stories'; 00274 $images = array(); 00275 $folders = array(); 00276 $folders[] = mosHTML::makeOption( '/' ); 00277 mosAdminMenus::ReadImages( $pathA, '/', $folders, $images ); 00278 // list of folders in images/stories/ 00279 $lists['folders'] = mosAdminMenus::GetImageFolders( $folders, $pathL ); 00280 // list of images in specfic folder in images/stories/ 00281 $lists['imagefiles'] = mosAdminMenus::GetImages( $images, $pathL ); 00282 // list of saved images 00283 $lists['imagelist'] = mosAdminMenus::GetSavedImages( $row, $pathL ); 00284 00285 // build list of users 00286 $active = ( intval( $row->created_by ) ? intval( $row->created_by ) : $my->id ); 00287 $lists['created_by'] = mosAdminMenus::UserSelect( 'created_by', $active ); 00288 // build the html select list for the group access 00289 $lists['access'] = mosAdminMenus::Access( $row ); 00290 // build the html select list for menu selection 00291 $lists['menuselect'] = mosAdminMenus::MenuSelect( ); 00292 // build the select list for the image positions 00293 $lists['_align'] = mosAdminMenus::Positions( '_align' ); 00294 // build the select list for the image caption alignment 00295 $lists['_caption_align'] = mosAdminMenus::Positions( '_caption_align' ); 00296 // build the select list for the image caption position 00297 $pos[] = mosHTML::makeOption( 'bottom', _CMN_BOTTOM ); 00298 $pos[] = mosHTML::makeOption( 'top', _CMN_TOP ); 00299 $lists['_caption_position'] = mosHTML::selectList( $pos, '_caption_position', 'class="inputbox" size="1"', 'value', 'text' ); 00300 00301 // get params definitions 00302 $params = new mosParameters( $row->attribs, $mainframe->getPath( 'com_xml', 'com_typedcontent' ), 'component' ); 00303 00304 HTML_typedcontent::edit( $row, $images, $lists, $params, $option, $menus ); 00305 }


| go2menu | ( | ) |
Definiert in Zeile 594 der Datei admin.typedcontent.php.
Benutzt $database, $menu, $row, josSpoofCheck(), mosGetParam() und mosRedirect().
00594 { 00595 global $database; 00596 00597 josSpoofCheck(); 00598 00599 // checkin content 00600 $row = new mosContent( $database ); 00601 $row->bind( $_POST ); 00602 $row->checkin(); 00603 00604 $menu = strval( mosGetParam( $_POST, 'menu', 'mainmenu' ) ); 00605 00606 mosRedirect( 'index2.php?option=com_menus&menutype='. $menu ); 00607 }

| go2menuitem | ( | ) |
Definiert in Zeile 609 der Datei admin.typedcontent.php.
Benutzt $database, $id, $menu, $row, josSpoofCheck(), mosGetParam() und mosRedirect().
00609 { 00610 global $database; 00611 00612 josSpoofCheck(); 00613 00614 // checkin content 00615 $row = new mosContent( $database ); 00616 $row->bind( $_POST ); 00617 $row->checkin(); 00618 00619 $menu = strval( mosGetParam( $_POST, 'menu', 'mainmenu' ) ); 00620 $id = intval( mosGetParam( $_POST, 'menuid', 0 ) ); 00621 00622 mosRedirect( 'index2.php?option=com_menus&menutype='. $menu .'&task=edit&hidemainmenu=1&id='. $id ); 00623 }

| menuLink | ( | $ | option, | |
| $ | id | |||
| ) |
Definiert in Zeile 557 der Datei admin.typedcontent.php.
Benutzt $database, $id, $link, $menu, $msg, $option, $row, ampReplace(), mosCache::cleanCache(), josSpoofCheck(), mosGetParam() und mosRedirect().
00557 { 00558 global $database; 00559 00560 josSpoofCheck(); 00561 00562 $menu = strval( mosGetParam( $_POST, 'menuselect', '' ) ); 00563 $link = strval( mosGetParam( $_POST, 'link_name', '' ) ); 00564 00565 $link = stripslashes( ampReplace($link) ); 00566 00567 $row = new mosMenu( $database ); 00568 $row->menutype = $menu; 00569 $row->name = $link; 00570 $row->type = 'content_typed'; 00571 $row->published = 1; 00572 $row->componentid = $id; 00573 $row->link = 'index.php?option=com_content&task=view&id='. $id; 00574 $row->ordering = 9999; 00575 00576 if (!$row->check()) { 00577 echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n"; 00578 exit(); 00579 } 00580 if (!$row->store()) { 00581 echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n"; 00582 exit(); 00583 } 00584 $row->checkin(); 00585 $row->updateOrder( "menutype=" . $database->Quote( $row->menutype ) . " AND parent=" . (int) $row->parent ); 00586 00587 // clean any existing cache files 00588 mosCache::cleanCache( 'com_content' ); 00589 00590 $msg = $link .' (Link - Static Content) in menu: '. $menu .' successfully created'; 00591 mosRedirect( 'index2.php?option='. $option .'&task=edit&hidemainmenu=1&id='. $id, $msg ); 00592 }

| resethits | ( | $ | option, | |
| $ | id | |||
| ) |
Function to reset Hit count of a content item
Definiert in Zeile 527 der Datei admin.typedcontent.php.
Benutzt $database, $id, $msg, $option, $row, josSpoofCheck() und mosRedirect().
00527 { 00528 global $database; 00529 00530 josSpoofCheck(); 00531 00532 $row = new mosContent($database); 00533 $row->Load( (int)$id ); 00534 $row->hits = "0"; 00535 $row->store(); 00536 $row->checkin(); 00537 00538 $msg = 'Successfully Reset Hit'; 00539 mosRedirect( 'index2.php?option='. $option .'&task=edit&hidemainmenu=1&id='. $row->id, $msg ); 00540 }

| save | ( | $ | option, | |
| $ | task | |||
| ) |
Saves the typed content item
Definiert in Zeile 310 der Datei admin.typedcontent.php.
Benutzt $_REQUEST, $database, $k, $menu, $mosConfig_offset, $msg, $my, $nullDate, $option, $params, $row, ampReplace(), mosCache::cleanCache(), josSpoofCheck(), menuLink(), mosFormatDate(), mosGetParam(), mosRedirect() und resethits().
Wird benutzt von Cache_Lite_Function::call(), components_menu_html::edit(), HTML_menumanager::edit(), HTML_content::editContent(), HTML_weblinks::editWeblink(), HTML_admin_misc::system_info(), HTML_user::userEdit() und view().
00310 { 00311 global $database, $my, $mosConfig_offset; 00312 00313 josSpoofCheck(); 00314 00315 $nullDate = $database->getNullDate(); 00316 $menu = strval( mosGetParam( $_POST, 'menu', 'mainmenu' ) ); 00317 $menuid = intval( mosGetParam( $_POST, 'menuid', 0 ) ); 00318 00319 $row = new mosContent( $database ); 00320 if (!$row->bind( $_POST )) { 00321 echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n"; 00322 exit(); 00323 } 00324 00325 if ($row->id) { 00326 $row->modified = date( 'Y-m-d H:i:s' ); 00327 $row->modified_by = $my->id; 00328 } 00329 00330 $row->created_by = $row->created_by ? $row->created_by : $my->id; 00331 00332 if ($row->created && strlen(trim( $row->created )) <= 10) { 00333 $row->created .= ' 00:00:00'; 00334 } 00335 $row->created = $row->created ? mosFormatDate( $row->created, _CURRENT_SERVER_TIME_FORMAT, -$mosConfig_offset ) : date( 'Y-m-d H:i:s' ); 00336 00337 if (strlen(trim( $row->publish_up )) <= 10) { 00338 $row->publish_up .= ' 00:00:00'; 00339 } 00340 $row->publish_up = mosFormatDate($row->publish_up, _CURRENT_SERVER_TIME_FORMAT, -$mosConfig_offset ); 00341 00342 if (trim( $row->publish_down ) == 'Never' || trim( $row->publish_down ) == '') { 00343 $row->publish_down = $nullDate; 00344 } else { 00345 if (strlen(trim( $row->publish_down )) <= 10) { 00346 $row->publish_down .= ' 00:00:00'; 00347 } 00348 $row->publish_down = mosFormatDate( $row->publish_down, _CURRENT_SERVER_TIME_FORMAT, -$mosConfig_offset ); 00349 } 00350 00351 $row->state = intval( mosGetParam( $_REQUEST, 'published', 0 ) ); 00352 00353 // Save Parameters 00354 $params = mosGetParam( $_POST, 'params', '' ); 00355 if (is_array( $params )) { 00356 $txt = array(); 00357 foreach ( $params as $k=>$v) { 00358 $txt[] = "$k=$v"; 00359 } 00360 $row->attribs = implode( "\n", $txt ); 00361 } 00362 00363 // code cleaner for xhtml transitional compliance 00364 $row->introtext = str_replace( '<br>', '<br />', $row->introtext ); 00365 00366 $row->title = ampReplace( $row->title ); 00367 00368 if (!$row->check()) { 00369 echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n"; 00370 exit(); 00371 } 00372 if (!$row->store()) { 00373 echo "<script> alert('".$row->getError()."'); window.history.go(-1); </script>\n"; 00374 exit(); 00375 } 00376 $row->checkin(); 00377 00378 // clean any existing cache files 00379 mosCache::cleanCache( 'com_content' ); 00380 00381 switch ( $task ) { 00382 case 'go2menu': 00383 mosRedirect( 'index2.php?option=com_menus&menutype='. $menu ); 00384 break; 00385 00386 case 'go2menuitem': 00387 mosRedirect( 'index2.php?option=com_menus&menutype='. $menu .'&task=edit&hidemainmenu=1&id='. $menuid ); 00388 break; 00389 00390 case 'menulink': 00391 menuLink( $option, $row->id ); 00392 break; 00393 00394 case 'resethits': 00395 resethits( $option, $row->id ); 00396 break; 00397 00398 case 'save': 00399 $msg = 'Typed Content Item saved'; 00400 mosRedirect( 'index2.php?option='. $option, $msg ); 00401 break; 00402 00403 case 'apply': 00404 default: 00405 $msg = 'Changes to Typed Content Item saved'; 00406 mosRedirect( 'index2.php?option='. $option .'&task=edit&hidemainmenu=1&id='. $row->id, $msg ); 00407 break; 00408 } 00409 }


| saveOrder | ( | &$ | cid | ) |
Definiert in Zeile 625 der Datei admin.typedcontent.php.
Benutzt $cid, $database, $i, $msg, $row, $total, mosCache::cleanCache(), josGetArrayInts(), josSpoofCheck() und mosRedirect().
00625 { 00626 global $database; 00627 00628 josSpoofCheck(); 00629 00630 $total = count( $cid ); 00631 $order = josGetArrayInts( 'order' ); 00632 00633 $row = new mosContent( $database ); 00634 $conditions = array(); 00635 00636 // update ordering values 00637 for ( $i=0; $i < $total; $i++ ) { 00638 $row->load( (int) $cid[$i] ); 00639 if ($row->ordering != $order[$i]) { 00640 $row->ordering = $order[$i]; 00641 if (!$row->store()) { 00642 echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n"; 00643 exit(); 00644 } // if 00645 // remember to updateOrder this group 00646 $condition = "catid=" . (int) $row->catid . " AND state >= 0"; 00647 $found = false; 00648 foreach ( $conditions as $cond ) 00649 if ($cond[1]==$condition) { 00650 $found = true; 00651 break; 00652 } // if 00653 if (!$found) $conditions[] = array($row->id, $condition); 00654 } // if 00655 } // for 00656 00657 // execute updateOrder for each group 00658 foreach ( $conditions as $cond ) { 00659 $row->load( $cond[0] ); 00660 $row->updateOrder( $cond[1] ); 00661 } // foreach 00662 00663 // clean any existing cache files 00664 mosCache::cleanCache( 'com_content' ); 00665 00666 $msg = 'New ordering saved'; 00667 mosRedirect( 'index2.php?option=com_typedcontent', $msg ); 00668 } // saveOrder

| trash | ( | &$ | cid, | |
| $ | option | |||
| ) |
Trashes the typed content item
Definiert in Zeile 414 der Datei admin.typedcontent.php.
Benutzt $cid, $database, $msg, $option, $query, $total, mosCache::cleanCache(), josSpoofCheck(), mosArrayToInts() und mosRedirect().
Wird benutzt von showMenu().
00414 { 00415 global $database; 00416 00417 josSpoofCheck(); 00418 00419 $total = count( $cid ); 00420 if ( $total < 1) { 00421 echo "<script> alert('Select an item to delete'); window.history.go(-1);</script>\n"; 00422 exit; 00423 } 00424 00425 $state = '-2'; 00426 $ordering = '0'; 00427 //seperate contentids 00428 mosArrayToInts( $cid ); 00429 $cids = 'id=' . implode( ' OR id=', $cid ); 00430 $query = "UPDATE #__content" 00431 . "\n SET state = " . (int) $state . ", ordering = " . (int) $ordering 00432 . "\n WHERE ( $cids )" 00433 ; 00434 $database->setQuery( $query ); 00435 if ( !$database->query() ) { 00436 echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n"; 00437 exit(); 00438 } 00439 00440 // clean any existing cache files 00441 mosCache::cleanCache( 'com_content' ); 00442 00443 $msg = $total ." Item(s) sent to the Trash"; 00444 mosRedirect( 'index2.php?option='. $option, $msg ); 00445 }

