A PHP Error was encountered

Severity: 8192

Message: Function create_function() is deprecated

Filename: geshi/geshi.php

Line Number: 4698

Backtrace:

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4646
Function: _optimize_regexp_list_tokens_to_string

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste

File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once

eta script - Stikked
From MikaT, 12 Years ago, written in Diff-output.
Embed
  1. diff --git a/.todo b/.todo
  2. index 78cca06..0a46199 100644
  3. --- a/.todo
  4. +++ b/.todo
  5. @@ -419,9 +419,12 @@
  6.                  Implemented
  7.              </comment>
  8.          </note>
  9. -        <note priority="veryhigh" time="1314084490">
  10. +        <note priority="veryhigh" time="1314084490" done="1314200784">
  11.              backup for config file and database
  12. -            <note priority="high" time="1314084565">
  13. +            <comment>
  14. +                Implemented
  15. +            </comment>
  16. +            <note priority="high" time="1314084565" done="0">
  17.                  configuration item for backup directory
  18.              </note>
  19.          </note>
  20. diff --git a/debian/control b/debian/control
  21. index 1d63d1b..0422bdf 100644
  22. --- a/debian/control
  23. +++ b/debian/control
  24. @@ -7,7 +7,7 @@ Standards-Version: 3.9.1
  25.  
  26.  Package: eta
  27.  Architecture: all
  28. -Depends: ${misc:Depends}, bc
  29. +Depends: ${misc:Depends}, bc, tar, bzip2
  30.  Description: Embelin Time Assistant, a nifty working hour management utility
  31.   ETA is a small but clever script for maintaining your working hours. It can
  32.   count over midnight and produce basic reports.
  33. diff --git a/eta b/eta
  34. index c72cc24..f6a8b6a 100755
  35. --- a/eta
  36. +++ b/eta
  37. @@ -21,7 +21,7 @@
  38.  shortusage()
  39.  {
  40.      echo "usage: `basename $0` [ <no params> | -a \"<yyyy-mm-dd [hh:mm - [yyyy-mm.dd] hh:mm] desc>\" ]"
  41. -    echo "       `basename $0` [ -c | -d \"<desc>\" | -e | -f <flt> | -F <flt> | -h | -m | -o | -p <r> | -r <min> | -R | -s | -y ]"
  42. +    echo "       `basename $0` [ -b | -c | -d \"<desc>\" | -e | -f <flt> | -F <flt> | -h | -m | -o | -p <r> | -r <min> | -R | -s | -y ]"
  43.      echo "       `basename $0` [ --version ]"
  44.      echo "       `basename $0` [ --help ]"
  45.  }
  46. @@ -34,6 +34,7 @@ usage()
  47.      echo "  -a \"<yyyy-mm-dd [hh:mm - [yyyy-mm-dd] hh:mm] desc>\"  Add a time row (e.g. \"2011-07-04 11:30 - 12:00 Script tuning\")."
  48.      echo "                                                     Note that if you have worked over midnight, you can add different"
  49.      echo "                                                     end date to the event."
  50. +    echo "  -b                                                 Backup event database and user configuration file."
  51.      echo "  -c                                                 Continue/start new time tracking event from the time previous ends,"
  52.      echo "                                                     use previous description."
  53.      echo "  -d \"<description>\"                                 Change latest description. If used with \"-s\" or \"-c\","
  54. @@ -1125,6 +1126,10 @@ readconfig()
  55.              WMLEN[$WMYEAR]="$WMMONTHS"
  56.              ;;
  57.  
  58. +        "backuppath")
  59. +            BUPATH="$PARAM"
  60. +            ;;
  61. +
  62.          *)
  63.              echo -e "\nUnknown configuration command [$CMD] in $1\n"
  64.              ;;
  65. @@ -1161,7 +1166,7 @@ REMOVELASTEVENT=""
  66.  FILTERINCLUDE=""
  67.  FILTEREXCLUDE=""
  68.  ASSUMEYES=""
  69. -
  70. +BACKUP=""
  71.  
  72.  #
  73.  # Check the global configuration file
  74. @@ -1178,6 +1183,8 @@ then
  75.  fi
  76.  
  77.  
  78. +#
  79. +# If default behaviour is configured, handle it here.
  80.  if [[ "$1" == "" ]] && [[ "$DEFBEHAVIOUR" == "" ]];
  81.  then
  82.      version
  83. @@ -1251,10 +1258,11 @@ fi
  84.  
  85.  
  86.  # Parse single command line parameters
  87. -while getopts 'a:cd:ef:F:hmop:r:Rsyv' opt;
  88. +while getopts 'a:bcd:ef:F:hmop:r:Rsyv' opt;
  89.  do
  90.      case $opt in
  91.      a)  ADDTIMEROW="$OPTARG";;
  92. +    b)  BACKUP="y";;
  93.      c)  STARTEVENT="y"; STARTFROMPREVTIME="y";;
  94.      d)  NEWDESCRIPTION="$OPTARG";;
  95.      e)  STOPEVENT="y";;
  96. @@ -1515,6 +1523,52 @@ then
  97.      fi
  98.  fi
  99.  
  100. +if [[ "$BACKUP" == "y" ]];
  101. +then
  102. +    if [[ "$BUPATH" != "" ]];
  103. +    then
  104. +        BUDIROK=""
  105. +
  106. +        # Files to backup: $TIMEDB, $MYRC
  107. +        BUFILE="`date +%Y-%m-%d_%H%M%S`.tar.bz2"
  108. +
  109. +        # Trick to replace ~ with $HOME
  110. +        ESCHOME=`echo $HOME | sed 's/\//#/g'`
  111. +        BUPATH=`echo $BUPATH | sed "s/\~/$ESCHOME/" | sed 's/#/\//g'`
  112. +
  113. +        # Check the backup path existance and try to create it if needed.
  114. +        if [ ! -d "$BUPATH" ];
  115. +        then
  116. +            echo "no $BUPATH, creating..."
  117. +            mkdir -p "$BUPATH"
  118. +
  119. +            if [[ "$?" == "0" ]];
  120. +            then
  121. +                BUDIROK="y"
  122. +            else
  123. +                BUDIROK=""
  124. +            fi
  125. +        else
  126. +            BUDIROK="y"
  127. +        fi
  128. +
  129. +        # If backup path is ok, try to create the backup.
  130. +        if [[ "$BUDIROK" == "y" ]];
  131. +        then
  132. +            tar -jcC $HOME -f $BUPATH$BUFILE `basename $TIMEDB` `basename $MYRC`
  133. +
  134. +            if [[ "$?" == "0" ]];
  135. +            then
  136. +                echo "backup file $BUFILE created."
  137. +            else
  138. +                echo "backup failed, check $BUPATH!"
  139. +            fi
  140. +        fi
  141. +    else
  142. +        echo "backup directory setting missing, backup was not created."
  143. +    fi
  144. +fi
  145. +
  146.  
  147.  # If only -r parameter is given, display current time rounded up and down.
  148.  # But if rounding comes from config file, don't display anything
  149. diff --git a/eta.1 b/eta.1
  150. index 09fbf64..d556118 100644
  151. --- a/eta.1
  152. +++ b/eta.1
  153. @@ -22,7 +22,7 @@
  154.  [ <no parameters> | \fB\-a\fR "<yyyy-mm-dd [hh:mm \- [yyyy-mm-dd] hh:mm] desc>" ]
  155.  .br
  156.  .B eta
  157. -[ \fB\-c\fR | \fB\-d\fR "<desc>" | \fB\-e\fR | \fB\-f\fR <flt> | \fB\-F\fR <flt> | \fB\-h\fR | \fB\-m\fR | \fB\-o\fR | \fB\-p\fR <r> | \fB\-r\fR <min> | \fB\-R\fR | \fB\-s\fR | \fB\-y\fR ]
  158. +[ \fB\-b\fR | \fB\-c\fR | \fB\-d\fR "<desc>" | \fB\-e\fR | \fB\-f\fR <flt> | \fB\-F\fR <flt> | \fB\-h\fR | \fB\-m\fR | \fB\-o\fR | \fB\-p\fR <r> | \fB\-r\fR <min> | \fB\-R\fR | \fB\-s\fR | \fB\-y\fR ]
  159.  .br
  160.  .B eta
  161.  [ \fB\-\-version\fR ]
  162. @@ -53,6 +53,9 @@ end date to the event.
  163.  
  164.  Also note: There is a special purpose syntax "yyyy-mm-dd desc" which you can use for "patching" a workday up to configured working day length with a given description. This is handy for example when reporting sickdays and holidays.
  165.  .TP
  166. +\fB\-b\fR
  167. +Backup event database and user configuration file. Backup location can be set in configuration file.
  168. +.TP
  169.  \fB\-c\fR
  170.  Continue/start new time tracking event from the time previous ends,
  171.  use previous description.
  172. @@ -227,6 +230,9 @@ Set the default working week lenght in workdays, usually 5 in Finland.
  173.  .TP
  174.  \fBworkingmonthlength\fR <yyyy> <Jan> <Feb> <Mar> <Apr> <May> <Jun> <Jul> <Aug> <Sep> <Oct> <Nov> <Dec>
  175.  Set the amount of expected working days for each month and year. This configuration option can be set for several years at the same time, see /etc/etarc for syntax and example.
  176. +.TP
  177. +\fBbackuppath\fR </path/to/backup/directory/>
  178. +Set a path to directory where backup files are copied. Note that final "/" needs to be included.
  179.  .SH COPYRIGHT
  180.  Copyright \(co 2011 Mika Tapojärvi <mika.tapojarvi@sse.fi>
  181.  .PP
  182. diff --git a/etarc b/etarc
  183. index fa5d9ef..64bc364 100644
  184. --- a/etarc
  185. +++ b/etarc
  186. @@ -50,3 +50,8 @@ workingweeklength 5
  187.  #                  yyyy Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
  188.  workingmonthlength 2010  20  20  23  19  22  20  21  23  22  21  22  20
  189.  workingmonthlength 2011  19  20  23  20  20  21  22  22  22  21  22  21
  190. +
  191. +# Backup path
  192. +backuppath ~/.eta_backup/
  193. +