Écrit par $gsl_header_author le $gsl_header_date
#!/bin/bash # file: gsl__page_creator # Folder: /var/lib/gsl/scripts # By echolib # License: GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007 #---------------------------------------------------------------------- # -------------------------------------------------- # From: gsl__all_makers | Create HTML Page # -------------------------------------------------- #---------------------------------------------------------------------- #---------------------------------------------------------------------- # MAIN #---------------------------------------------------------------------- gsl__page_creator() { #gsl__page_prepare_datas gsl__check_templates gsl__html_meta_head gsl__page_create cat -n "$gsl_srv_wip_page" } #====================================================================== # Sync Files from Templates to webserver #====================================================================== gsl__srv_sync() { # Sync Files and Folders mkdir -p "$1" for folder in `find $gsl_this_conf_domain/* -type d` do rsync -a --delete "$folder" "$1" && \ gsl__logs_print \ "$gsl_log_i" \ "Server" \ "Sync" \ "$folder" \ "$1" done } #---------------------------------------------------------------------- # Get Datas for Post/Page #---------------------------------------------------------------------- gsl__page_prepare_datas() { # Set wip folder from domain gsl_srv_wip="$gsl_site_server/$gsl_site_ndd/wip" gsl_srv_www="$gsl_site_server/$gsl_site_ndd/www" # Post or Page case "$gsl_post_type" in post) gsl_srv_wip_page="$gsl_srv_wip/$gsl_header_slug/index.html" gsl_srv_www_page="$gsl_srv_www/$gsl_header_slug/index.html" gsl__check_srv_files "$gsl_srv_wip_page" wip gsl__check_srv_files "$gsl_srv_www_page" www gsl_uri=".." ;; page) gsl_srv_wip_page="$gsl_srv_wip/$gsl_header_slug.html" gsl_srv_www_page="$gsl_srv_www/$gsl_header_slug.html" gsl__check_srv_files "$gsl_srv_wip_page" wip gsl__check_srv_files "$gsl_srv_www_page" www gsl_uri="." ;; esac gsl_uri_site_logo="$gsl_uri/templates/$gsl_site_logo" } #---------------------------------------------------------------------- # Check if Post / Pages exists in server #---------------------------------------------------------------------- gsl__check_srv_files() { if [[ -f "$1" ]];then gsl__logs_print \ "$gsl_log_i" \ "SRV" \ "$2" \ "$gsl_post_type $gsl_post exists" \ "$1" else gsl__logs_print \ "$gsl_log_w" \ "SRV" \ "$2" \ "$gsl_post_type $gsl_post not yet created" \ "$1" gsl_checker_war=true fi } #====================================================================== # latest Posts listing Manager #====================================================================== gsl__page_listing_create() { # Check if Post is in list ; Status Made gsl_checker_war=true gsl_listing_file="$gsl_dir_domain_listings/$gsl_post.list" if [[ `ls -1 "$gsl_listing_file"* 2>/dev/null` ]];then gsl__logs_print \ "$gsl_log_w" \ "Post" \ "Latest" \ "$gsl_post_list $gsl_post ; already added to Listing" \ "$gsl_dir_domain_listings/" return fi case "$gsl_post_list" in Pin) gsl_listing_start_n=1 [[ $gsl_post_pin ]] \ && sed -i "s|gsl_post_pin.*|gsl_post_pin=$gsl_header_title|" \ "$gsl_this_conf_domain/$gsl_find_domain.conf" \ || echo "gsl_post_pin=$gsl_header_title" \ >> "$gsl_this_conf_domain/$gsl_find_domain.conf" ;; Add) # Check if a post is pinned [[ $gsl_post_pin ]] \ && gsl_listing_start_n=2 \ || gsl_listing_start_n=1 ;; esac gsl__page_listing_roller gsl__page_listing_create_file "$gsl_listing_file.$gsl_listing_start_n" cat `ls -1r "$gsl_dir_domain_listings/"*.list.*` \ > "$gsl_dir_domain_tpl/last-posts-list.html" \ && gsl__logs_print \ "$gsl_log_w" \ "Post" \ "Latest" \ "Create Listing (Merged .list.*)"\ "$gsl_dir_domain_tpl/last-post-list.html" } #====================================================================== # Create HTML List from selected Post #====================================================================== gsl__page_listing_create_file() { cat << EOPostSide > "$1"