É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 for folder in `find $gsl_this_conf_domain/* -type d` do rsync -a "$folder" "$gsl_srv_wip" && \ gsl__logs_print \ "$gsl_log_w" \ "Server" \ "Sync" \ "$folder" \ "$gsl_srv_wip" done } #---------------------------------------------------------------------- # Get Datas for Post/Page #---------------------------------------------------------------------- gsl__page_prepare_datas() { #echo "D> $gsl_this_conf_domain" # Source config website (DATAS) source "$gsl_this_conf_domain/$gsl_find_domain.conf" # Get Needed Headers DATAS gsl__get_needed_headers # Check for Files & Folders in server gsl_srv_wip="$gsl_site_server/$gsl_site_ndd/wip" # Post or Page case "$gsl_post_type" in post) gsl_srv_wip_page="$gsl_srv_wip/$gsl_header_slug/index.html" gsl__check_srv_files "$gsl_srv_wip_page" gsl_uri=".." ;; page) gsl_srv_wip_page="$gsl_srv_wip/$gsl_header_slug.html" gsl__check_srv_files "$gsl_srv_wip_page" 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 echo "! Replace Page: $1" fi } #====================================================================== # Create Post Listing #====================================================================== gsl__page_create_listing() { # Check if Post is in list ; Status Made case "$gsl_db_post_status" in wip|www) gsl__logs_print \ "$gsl_log_i" \ "Post" \ "Make" \ "$gsl_post already added to Latest listings" \ "$gsl_file_db_posts" return ;; esac touch "$gsl_dir_domain_tpl/last-posts-list.html" gsl_list_max_posts=5 gsl_list_lines_per_post=5 gsl_list_max_lines=$(( gsl_list_max_posts * gsl_list_lines_per_post)) gsl_list_cur_lines=` cat "$gsl_dir_domain_tpl/last-posts-list.html" \ | wc -l` if (( $((gsl_list_cur_lines )) >= $gsl_list_max_lines ));then echo "D> $gsl_list_cur_lines > $gsl_list_max_lines" for i in `seq 1 $gsl_list_lines_per_post` do sed -i "1d" "$gsl_dir_domain_tpl/last-posts-list.html" done fi cat << EOPostSide >> "$gsl_dir_domain_tpl/last-posts-list.html"