Current time: 11-23-2024, 12:03 PM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CronJob Russian Solution
Author Message
data-stream_ru Offline
Moderator
*****
Moderators

Posts: 471
Joined: Jan 2009
Reputation: 7
Post: #32
RE: CronJob Russian Solution
Подсветка текущих значений времени крона в режиме редактирования.
Не знаю как к этому отнесутся все броузеры, но опера стерпела. Определять же все масссивы ручками в нуль мне жуть как лень.

client/cronjobs_edit.tpl
PHP Code:
<html>
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset={THEME_CHARSET}">
<
title>{TR_CLIENT_CRONJOBS_TITLE}</title>
  <
meta name="robots" content="noindex">
  <
meta name="robots" content="nofollow">
<
link href="{THEME_COLOR_PATH}/css/ispcp.css" rel="stylesheet" type="text/css">
<
script type="text/javascript" src="{THEME_COLOR_PATH}/css/ispcp.js"></script>
</head>

<body onload="MM_preloadImages('{THEME_COLOR_PATH}/images/icons/database_a.gif','{THEME_COLOR_PATH}/images/icons/domains_a.gif','{THEME_COLOR_PATH}/images/icons/ftp_a.gif','{THEME_COLOR_PATH}/images/icons/general_a.gif' ,'{THEME_COLOR_PATH}/images/icons/email_a.gif','{THEME_COLOR_PATH}/images/icons/webtools_a.gif','{THEME_COLOR_PATH}/images/icons/statistics_a.gif','{THEME_COLOR_PATH}/images/icons/support_a.gif')">
<!-- BDP: logged_from --><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="20" nowrap="nowrap" class="backButton">&nbsp;&nbsp;&nbsp;<a href="change_user_interface.php?action=go_back"><img src="{THEME_COLOR_PATH}/images/icons/close_interface.png" width="16" height="16" border="0" align="absmiddle"></a> {YOU_ARE_LOGGED_AS}</td>
      </tr>
    </table>
    <!-- EDP: logged_from -->
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%" style="border-collapse: collapse;padding:0;margin:0;">
<tr>
<td align="left" valign="top" style="vertical-align: top; width: 195px; height: 56px;"><img src="{THEME_COLOR_PATH}/images/top/top_left.jpg" border="0"></td>
<td style="height: 56px; width:100%; background-image: url({THEME_COLOR_PATH}/images/top/top_bg.jpg)"><img src="{THEME_COLOR_PATH}/images/top/top_left_bg.jpg" border="0"></td>
<td style="width: 73px; height: 56px;"><img src="{THEME_COLOR_PATH}/images/top/top_right.jpg" border="0"></td>
</tr>
    <tr>
        <td style="width: 195px; vertical-align: top;">{MENU}</td>
        <td colspan="2" style="vertical-align: top;"><table style="width: 100%; border-collapse: collapse;padding:0;margin:0;">
          <tr height="95">
            <td style="padding-left:30px; width: 100%; background-image: url({THEME_COLOR_PATH}/images/top/middle_bg.jpg);">{MAIN_MENU}</td>
            <td style="padding:0;margin:0;text-align: right; width: 73px;vertical-align: top;"><img src="{THEME_COLOR_PATH}/images/top/middle_right.jpg" border="0"></td>
          </tr>
          <tr>
            <td colspan="3"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td align="left"><table width="100%" cellpadding="5" cellspacing="5">
                    <tr>
                      <td width="25"><img src="{THEME_COLOR_PATH}/images/content/table_icon_tools.png" width="25" height="25"></td>
                      <td colspan="2" class="title">{TR_CRON_MANAGER}</td>
                    </tr>
                </table></td>
                <td width="27" align="right">&nbsp;</td>
              </tr>
              <tr>
                <td><form name="add_cronjob" method="post" action="cronjobs_edit.php?cron_id={ID}">
                    <table width="100%" cellpadding="5" cellspacing="5">
                      <tr>
                        <td width="25">&nbsp;</td>
                        <td colspan="5" class="content3"><b>{TR_EDIT_CRONJOB}</b></td>
                      </tr>
                      <!-- BDP: page_message -->
                      <tr>
                        <td width="25">&nbsp;</td>
                        <td colspan="5" class="title"><span class="message">{MESSAGE}</span></td>
                      </tr>
                      <!-- EDP: page_message -->
                      <tr>
                        <td nowrap="nowrap">&nbsp;</td>
                        <td nowrap="nowrap" class="content2">{TR_NAME}</td>
                        <td colspan="4" class="content"><input name="name" type="text" class="textinput" id="name" style="width:170px" value="{NAME}"></td>
                      </tr>
                      <tr>
                        <td nowrap="nowrap">&nbsp;</td>
                        <td nowrap="nowrap" class="content2">{TR_DESCRIPTION}</td>
                        <!--td colspan="4" class="content"><input name="description" type="text" class="textinput" id="description" style="width:170px" value="{DESCTIPTON}"></td-->
                        <td colspan="4" class="content"><input name="description" type="text" class="textinput" id="description" style="width:170px" value="{DESCRIPTION}"></td>
                      </tr>
                        <tr>
                        <td nowrap="nowrap">&nbsp;</td>
                        <td nowrap="nowrap" class="content2">{TR_ACTIVE}</td>
                        <td colspan="4" class="content"><select name="activ">
                              <option value="1" {ACTIVE_YES}>{YES}</option>
                            <option value="0" {ACTIVE_NO}>{NO}</option>
                        </select></td>
                      </tr>
                      <tr>
                        <td nowrap="nowrap">&nbsp;</td>
                        <td nowrap="nowrap" class="content2">Run only once and when delete Job</td>
                        <td colspan="4" class="content"><select name="runonce">
                            <option value="1" {RUNONCE_YES}>{YES}</option>
                            <option value="-1" {RUNONCE_NO}>{NO}</option>
                        </select></td>
                      </tr>
                      <tr>
                        <td>&nbsp;</td>
                        <td colspan="5" class="content3"><b>{TR_CRONJOB}</b></td>
                      </tr>
                     <tr>
                        <td width="25">&nbsp;</td>
                        <td colspan="3" class="content2">{TR_COMMAND}</td>
               <td colspan="2" class="content2">Comand Line    Syntax:</td>
                      </tr>
                      <tr>
                        <td width="25">&nbsp;</td>
                        <td colspan="3" class="content"><input name="command_line" type="text" class="textinput" id="command_line" style="width:370px" value="{COMMAND_LINE}"></td>
                <td colspan="2" class="content2">Enter properly COMMAND, space, full SERVER PATH to executed script!</td>
                      </tr>
                      <tr>
                        <td width="25">&nbsp;</td>
               <td colspan="5" class="content2">Allowed commands in only <b>{ALLOWED}</b> . And allowed file extension is <b>{FILETYPE}</b></td>
                      </tr>
                      <tr>
                        <td nowrap="nowrap">&nbsp;</td>
                        <td align="center" nowrap="nowrap" class="content2">{TR_MIN}</td>
                        <td align="center" class="content2">{TR_HOUR}</td>
                        <td align="center" class="content2">{TR_DAY}</td>
                        <td align="center" class="content2">{TR_MONTHS}</td>
                        <td align="center" class="content2">{TR_WEEKDAYS}</td>
                      </tr>
                      <tr align="center" valign="top">
                        <td width="25" nowrap="nowrap">&nbsp;</td>
                        <td width="200" nowrap="nowrap" class="content"><select name="min[]" size="6" multiple id="min"">
                            <option value="*" {TR_SELECTED_MIN_*}>Every Minute</option>
                            <option value="*/2" {TR_SELECTED_MIN_*/2}>Every Other Minute</option>
                            <option value="*/5" {TR_SELECTED_MIN_*/5}>Every Five Minutes</option>
                            <option value="*/10" {TR_SELECTED_MIN_*/10}>Every Ten Minutes</option>
                            <option value="*/15" {TR_SELECTED_MIN_*/15}>Every Fifteen Minutes</option>
                            <option value="0" {TR_SELECTED_MIN_0}>0</option>
                            <option value="1" {TR_SELECTED_MIN_1}>1</option>
                            <option value="2" {TR_SELECTED_MIN_2}>2</option>
                            <option value="3" {TR_SELECTED_MIN_3}>3</option>
                            <option value="4" {TR_SELECTED_MIN_4}>4</option>
                            <option value="5" {TR_SELECTED_MIN_5}>5</option>
                            <option value="6" {TR_SELECTED_MIN_6}>6</option>
                            <option value="7" {TR_SELECTED_MIN_7}>7</option>
                            <option value="8" {TR_SELECTED_MIN_8}>8</option>
                            <option value="9" {TR_SELECTED_MIN_9}>9</option>
                            <option value="10" {TR_SELECTED_MIN_10}>10</option>
                            <option value="11" {TR_SELECTED_MIN_11}>11</option>
                            <option value="12" {TR_SELECTED_MIN_12}>12</option>
                            <option value="13" {TR_SELECTED_MIN_13}>13</option>
                            <option value="14" {TR_SELECTED_MIN_14}>14</option>
                            <option value="15" {TR_SELECTED_MIN_15}>15</option>
                            <option value="16" {TR_SELECTED_MIN_16}>16</option>
                            <option value="17" {TR_SELECTED_MIN_17}>17</option>
                            <option value="18" {TR_SELECTED_MIN_18}>18</option>
                            <option value="19" {TR_SELECTED_MIN_19}>19</option>
                            <option value="20" {TR_SELECTED_MIN_20}>20</option>
                            <option value="21" {TR_SELECTED_MIN_21}>21</option>
                            <option value="22" {TR_SELECTED_MIN_22}>22</option>
                            <option value="23" {TR_SELECTED_MIN_23}>23</option>
                            <option value="24" {TR_SELECTED_MIN_24}>24</option>
                            <option value="25" {TR_SELECTED_MIN_25}>25</option>
                            <option value="26" {TR_SELECTED_MIN_26}>26</option>
                            <option value="27" {TR_SELECTED_MIN_27}>27</option>
                            <option value="28" {TR_SELECTED_MIN_28}>28</option>
                            <option value="29" {TR_SELECTED_MIN_29}>29</option>
                            <option value="30" {TR_SELECTED_MIN_30}>30</option>
                            <option value="31" {TR_SELECTED_MIN_31}>31</option>
                            <option value="32" {TR_SELECTED_MIN_32}>32</option>
                            <option value="33" {TR_SELECTED_MIN_33}>33</option>
                            <option value="34" {TR_SELECTED_MIN_34}>34</option>
                            <option value="35" {TR_SELECTED_MIN_35}>35</option>
                            <option value="36" {TR_SELECTED_MIN_36}>36</option>
                            <option value="37" {TR_SELECTED_MIN_37}>37</option>
                            <option value="38" {TR_SELECTED_MIN_38}>38</option>
                            <option value="39" {TR_SELECTED_MIN_39}>39</option>
                            <option value="40" {TR_SELECTED_MIN_40}>40</option>
                            <option value="41" {TR_SELECTED_MIN_41}>41</option>
                            <option value="42" {TR_SELECTED_MIN_42}>42</option>
                            <option value="43" {TR_SELECTED_MIN_43}>43</option>
                            <option value="44" {TR_SELECTED_MIN_44}>44</option>
                            <option value="45" {TR_SELECTED_MIN_45}>45</option>
                            <option value="46" {TR_SELECTED_MIN_46}>46</option>
                            <option value="47" {TR_SELECTED_MIN_47}>47</option>
                            <option value="48" {TR_SELECTED_MIN_48}>48</option>
                            <option value="49" {TR_SELECTED_MIN_49}>49</option>
                            <option value="50" {TR_SELECTED_MIN_50}>50</option>
                            <option value="51" {TR_SELECTED_MIN_51}>51</option>
                            <option value="52" {TR_SELECTED_MIN_52}>52</option>
                            <option value="53" {TR_SELECTED_MIN_53}>53</option>
                            <option value="54" {TR_SELECTED_MIN_54}>54</option>
                            <option value="55" {TR_SELECTED_MIN_55}>55</option>
                            <option value="56" {TR_SELECTED_MIN_56}>56</option>
                            <option value="57" {TR_SELECTED_MIN_57}>57</option>
                            <option value="58" {TR_SELECTED_MIN_58}>58</option>
                            <option value="59" {TR_SELECTED_MIN_59}>59</option>
                            </select></td>
                        <td class="content"><select name="hour[]" multiple size="6" id="hour">
                            <option value="*" {TR_SELECTED_HOUR_*}>Every Hour</option>
                            <option value="*/2" {TR_SELECTED_HOUR_*/2}>Every Other Hour</option>
                            <option value="*/4" {TR_SELECTED_HOUR_*/4}>Every Four Hours</option>
                            <option value="*/6" {TR_SELECTED_HOUR_*/6}>Every Six Hours</option>
                            <option value="0" {TR_SELECTED_HOUR_0}>0 = 12 AM/Midnight</option>
                            <option value="1" {TR_SELECTED_HOUR_1}>1 = 1 AM</option>
                            <option value="2" {TR_SELECTED_HOUR_2}>2 = 2 AM</option>
                            <option value="3" {TR_SELECTED_HOUR_3}>3 = 3 AM</option>
                            <option value="4" {TR_SELECTED_HOUR_4}>4 = 4 AM</option>
                            <option value="5" {TR_SELECTED_HOUR_5}>5 = 5 AM</option>
                            <option value="6" {TR_SELECTED_HOUR_6}>6 = 6 AM</option>
                            <option value="7" {TR_SELECTED_HOUR_7}>7 = 7 AM</option>
                            <option value="8" {TR_SELECTED_HOUR_8}>8 = 8 AM</option>
                            <option value="9" {TR_SELECTED_HOUR_9}>9 = 9 AM</option>
                            <option value="10" {TR_SELECTED_HOUR_10}>10 = 10 AM</option>
                            <option value="11" {TR_SELECTED_HOUR_11}>11 = 11 AM</option>
                            <option value="12" {TR_SELECTED_HOUR_12}>12 = 12 PM/Noon</option>
                            <option value="13" {TR_SELECTED_HOUR_13}>13 = 1 PM</option>
                            <option value="14" {TR_SELECTED_HOUR_14}>14 = 2 PM</option>
                            <option value="15" {TR_SELECTED_HOUR_15}>15 = 3 PM</option>
                            <option value="16" {TR_SELECTED_HOUR_16}>16 = 4 PM</option>
                            <option value="17" {TR_SELECTED_HOUR_17}>17 = 5 PM</option>
                            <option value="18" {TR_SELECTED_HOUR_18}>18 = 6 PM</option>
                            <option value="19" {TR_SELECTED_HOUR_19}>19 = 7 PM</option>
                            <option value="20" {TR_SELECTED_HOUR_20}>20 = 8 PM</option>
                            <option value="21" {TR_SELECTED_HOUR_21}>21 = 9 PM</option>
                            <option value="22" {TR_SELECTED_HOUR_22}>22 = 10 PM</option>
                            <option value="23" {TR_SELECTED_HOUR_23}>23 = 11 PM</option>
                            </select></td>
                        <td class="content"><select name="day_of_month[]" multiple size="6" id="day_of_month">
                            <option value="*" {TR_SELECTED_DOM_*}>Every Day</option>
                            <option value="1" {TR_SELECTED_DOM_1}>1</option>
                            <option value="2" {TR_SELECTED_DOM_2}>2</option>
                            <option value="3" {TR_SELECTED_DOM_3}>3</option>
                            <option value="4" {TR_SELECTED_DOM_4}>4</option>
                            <option value="5" {TR_SELECTED_DOM_5}>5</option>
                            <option value="6" {TR_SELECTED_DOM_6}>6</option>
                            <option value="7" {TR_SELECTED_DOM_7}>7</option>
                            <option value="8" {TR_SELECTED_DOM_8}>8</option>
                            <option value="9" {TR_SELECTED_DOM_9}>9</option>
                            <option value="10" {TR_SELECTED_DOM_10}>10</option>
                            <option value="11" {TR_SELECTED_DOM_11}>11</option>
                            <option value="12" {TR_SELECTED_DOM_12}>12</option>
                            <option value="13" {TR_SELECTED_DOM_13}>13</option>
                            <option value="14" {TR_SELECTED_DOM_14}>14</option>
                            <option value="15" {TR_SELECTED_DOM_15}>15</option>
                            <option value="16" {TR_SELECTED_DOM_16}>16</option>
                            <option value="17" {TR_SELECTED_DOM_17}>17</option>
                            <option value="18" {TR_SELECTED_DOM_18}>18</option>
                            <option value="19" {TR_SELECTED_DOM_19}>19</option>
                            <option value="20" {TR_SELECTED_DOM_20}>20</option>
                            <option value="21" {TR_SELECTED_DOM_21}>21</option>
                            <option value="22" {TR_SELECTED_DOM_22}>22</option>
                            <option value="23" {TR_SELECTED_DOM_23}>23</option>
                            <option value="24" {TR_SELECTED_DOM_24}>24</option>
                            <option value="25" {TR_SELECTED_DOM_25}>25</option>
                            <option value="26" {TR_SELECTED_DOM_26}>26</option>
                            <option value="27" {TR_SELECTED_DOM_27}>27</option>
                            <option value="28" {TR_SELECTED_DOM_28}>28</option>
                            <option value="29" {TR_SELECTED_DOM_29}>29</option>
                            <option value="30" {TR_SELECTED_DOM_30}>30</option>
                            <option value="31" {TR_SELECTED_DOM_31}>31</option>
                            </select></td>
                        <td class="content"><select name="month[]" multiple size="6" id="month">
                            <option value="*" {TR_SELECTED_MONTH_*}>Every Month</option>
                            <option value="1" {TR_SELECTED_MONTH_1}>January</option>
                            <option value="2" {TR_SELECTED_MONTH_2}>February</option>
                            <option value="3" {TR_SELECTED_MONTH_3}>March</option>
                            <option value="4" {TR_SELECTED_MONTH_4}>April</option>
                            <option value="5" {TR_SELECTED_MONTH_5}>May</option>
                            <option value="6" {TR_SELECTED_MONTH_6}>June</option>
                            <option value="7" {TR_SELECTED_MONTH_7}>July</option>
                            <option value="8" {TR_SELECTED_MONTH_8}>August</option>
                            <option value="9" {TR_SELECTED_MONTH_9}>September</option>
                            <option value="10" {TR_SELECTED_MONTH_10}>October</option>
                            <option value="11" {TR_SELECTED_MONTH_11}>November</option>
                            <option value="12" {TR_SELECTED_MONTH_12}>December</option>
                            </select></td>
                        <td class="content"><select name="day_of_week[]" multiple size="6" id="day_of_week">
                            <option value="*" {TR_SELECTED_DOW_*}>Every Weekday</option>
                            <option value="0" {TR_SELECTED_DOW_0}>Sunday</option>
                            <option value="1" {TR_SELECTED_DOW_1}>Monday</option>
                            <option value="2" {TR_SELECTED_DOW_2}>Tuesday</option>
                            <option value="3" {TR_SELECTED_DOW_3}>Wednesday</option>
                            <option value="4" {TR_SELECTED_DOW_4}>Thursday</option>
                            <option value="5" {TR_SELECTED_DOW_5}>Friday</option>
                            <option value="6" {TR_SELECTED_DOW_6}>Saturday</option>
                            </select></td>
                      </tr>
                      <tr>
                        <td width="25">&nbsp;</td>
                        <td colspan="5"><input name="Submit" type="submit" class="button" value="  {TR_UPDATE}  ">
                          &nbsp;&nbsp;                  &nbsp;&nbsp;
                          <input name="button" type="button" class="button" onclick="MM_goToURL('parent','cronjobs_overview.php');return document.MM_returnValue" value="{TR_CANCEL}"></td>
                      </tr>
                    </table>
                  <input type="hidden" name="uaction" value="update_cronjob">
                </form></td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
              </tr>
            </table></td>
          </tr>
        </table></td>
    </tr>
</table>
</body>
</html> 

client/cronjobs_edit.php

PHP Code:
<?php
/*
* (с) 2009, Russia, Moscow
* Serge Obookhoff AKA Hong Lee
* www.data-stream.ru && www.veterinars.ru
* Last Revision at 01/2009
*     Written for ispCP Team (www.isp-control.net) ONLY.
*     Written using the old, dead blanks VHCS.
* All Functions rewritten.
*
* Notice: If you use this script you have own risks.
*  
*/

//bypass ispCP HTML input control

$min implode ("," $_POST['min']);
$hour implode ("," $_POST['hour']);
$day_of_month implode ("," $_POST['day_of_month']);
$month implode ("," $_POST['month']);
$day_of_week implode ("," $_POST['day_of_week']);

unset(
$_POST['month'], $_POST['day_of_week'], $_POST['min'], $_POST['hour'], $_POST['day_of_month']);


require 
'../include/ispcp-lib.php';

check_login(__FILE__);

$tpl = new pTemplate();
$tpl->define_dynamic('page'Config::get('CLIENT_TEMPLATE_PATH') . '/cronjobs_edit.tpl');
$tpl->define_dynamic('page_message''page');
$tpl->define_dynamic('logged_from''page');

$theme_color Config::get('USER_INITIAL_THEME');

$tpl->assign(
    array(
'TR_CLIENT_CRONJOBS_TITLE' => tr('ispCP - Client/Cronjob Manager'),
        
'THEME_COLOR_PATH' => "../themes/$theme_color",
        
'THEME_CHARSET' => tr('encoding'),
        
'ISP_LOGO' => get_logo($_SESSION['user_id'])
        )
    );

    if (!isset(
$_GET['cron_id']) && !isset($_POST['Submit'])) {
    
set_page_message(tr('Nothing to do!'));
    
user_goto('cronjobs_overview.php');
    }

if (isset(
$_GET['cron_id']) && $_GET['cron_id'] !== '') {
    
$cron_id $_GET['cron_id'];}


function 
update_cron_job(&$tpl, &$sql$cron_id$user_id, &$min, &$hour, &$day_of_month, &$month, &$day_of_week, &$file_type) {

/*    if ((empty($min) | empty($hour) | empty($day_of_month) | empty($month) | empty($day_of_week) | empty($_POST['name']) | empty($_POST['description']) | empty($_POST['command_line'])) && isset($_POST['Submit'])) {
*
*        set_page_message(tr('Please type All Fields and choise all Values!'));
*        return;
*    }
*/
    
foreach($_POST as $key => $value)
    {
        
$a $key;
        $
$a $value;
    }



    
//do all checks of command_line
/* Start (c) Vladimir Sinitsyn*/
// Vladimir Sinitsyn aka SenatoR
// Russia, Yekaterinburg
// Русские, привет! =)
// $command_line mey be "perl /var/www/virtual/hackers.ru/htdocs/cgi-bin/decoder.pl?file=/etc/passwd-"
// We must use security check!

#    $stop_word = array('/etc/','password','passwd','groups'); //STOP Words!

$stop_word Config::get('CUSTOM_CRON_STOP_WORD'); //STOP Words!
$stop_word explode(","$stop_word);
//Let`s start our work!

$temp explode(" "$command_line); //We`ve divided line two parts - command (php) and values.

$command $temp[0];
$stream $temp[1];

unset(
$temp);

//We have commands, so, make it without "cool" things, use simle code..

$cron_allowed_commands Config::get('CUSTOM_CRON_ALLOWED_CMD');
$cron_allowed_commands explode(","$cron_allowed_commands);

$flag 0;

foreach(
$cron_allowed_commands as $k=>$v)
{
    if(
strpos($command,$v) === 0)
        {
            
$flag++;
            break; 
//Stop
        

}

unset (
$cron_allowed_commands);

if (
$flag == 0) {
    
set_page_message(tr('Comand not Allowed!'));
    return;
    }

foreach(
$stop_word as $k=>$v)
{
    if(
strpos($stream,$v) == true) {
        
set_page_message(tr('Are you a cunning Hacker ?! But I am not only stupid machine!!! I will write delation to Admin!'));
        
write_log("WARNING: Perhaps hacking! "$_SESSION['user_logged'] . ": add Cron Job: " $name " with comnd: " $command_line);
        
user_goto('cronjobs_edit.php');
        return 
0;
        }  
//Hackers ALLERT... `stop word'
}


$flag 0//Use one thing!

  
foreach($file_type as $k=>$v//Start
  
{
      if(
strpos($stream,$v) == true//Works fast!!! (its important)
    
{    
        
$flag++; //Yeah! Its good!
      
         
$file preg_replace("/(\\".".".$v.").*/i","\\1",$stream); //CUT ALL!!! Only filename in $file!

        
break; //Stop
    
}
  }

 if(
$flag == 0) {
    
set_page_message(tr('File type wrong!'));
    return;
    }
//File type wrong!

//Check files and permission

if(!file_exists($file)) {
    
set_page_message(tr('File not found!'));
    return;
    } 
//No file!

if(!is_readable($file)) {
    
set_page_message(tr('File not readable!'));
    return;
    }; 
//Wrong permissions!

if(strpos("cgi",$file) || strpos("pl",$file)) // only for cgi and pl and so..
{
    if(!
is_executable($file)) {
    
set_page_message(tr('Wrong permissions!'));
    return;
    }; 
//Wrong permissions!
}
/* End (c) */


    
$query "
        UPDATE
            hcrondtab
        SET
            name = ?, coment = ?, min = ?, hour = ?, day = ?, mon = ?, dow = ?, cmd = ?, activ = ?, runonce = ?, lastrun = ?
        WHERE
            id = ?
    "
;

    
$rs exec_query($sql$query, array($name$description$min$hour$day_of_month$month$day_of_week$command_line$activ$runonce$lastrun =0$cron_id));



    
write_log($_SESSION['user_logged'] . ": updeted Cron Job: " $name);
    
set_page_message(tr('Cron Job successfully updated!'));
    
user_goto('cronjobs_overview.php');

// End of update_cron_job();


function gen_cron_job(&$tpl, &$sql$cron_id$user_id, &$new_value) {

    
$query "
        SELECT
            `id`, `domain`, `name`, `coment`, `min`, `hour`, `day`, `mon`, `dow`, `cmd`, `runonce`,`lastrun`, `activ`
        FROM
            `hcrondtab`
        WHERE
            domain = 
$user_id
     AND
         id = 
$cron_id
    "
;

    
$rs exec_query($sql$query$cron_id);

    if (
$rs->RecordCount() == 0) {
    
set_page_message(tr('No CronJob with this ID!'));
    
header('Location: cronjobs_overview.php');
    exit(
0);
    }

        
    if (
$rs->fields['activ'] == 1) {$active_yes 'selected'$active_no '';}
    else  {
$active_no 'selected'$active_yes '';}
    if (
$rs->fields['runonce'] == 1) {$runonce_yes 'selected'$runonce_no '';}
    else  {
$runonce_no 'selected'$runonce_yes '';}
    
$tpl->assign(
        array(
'NAME' => $rs->fields['name'],
            
'DESCRIPTION' => $rs->fields['coment'],
            
'COMMAND_LINE' => $rs->fields['cmd'],
            
'ACTIVE' => $rs->fields['activ'],
            
'ACTIVE_YES' => $active_yes,
            
'ACTIVE_NO' => $active_no,
            
'ID'  => $rs->fields['id'],
            
'ALLOWED' => 'php, perl, python',
            
'FILETYPE' => $new_value,
            
'RUNONCE_YES' => $runonce_yes,
            
'RUNONCE_NO' => $runonce_no,
            )
        );

//Highlite time selection

    
$cron_time explode(",",$rs->fields['min']);

    foreach(
$cron_time as $k=>$v)
    {
        
$selected_time[$k] = "TR_SELECTED_MIN_".$v;
        
$tpl->assign(array($selected_time[$k] => tr('selected') ));
    }

    
$cron_time explode(",",$rs->fields['hour']);

    foreach(
$cron_time as $k=>$v)
    {
        
$selected_time[$k] = "TR_SELECTED_HOUR_".$v;
        
$tpl->assign(array($selected_time[$k] => tr('selected') ));
    }

    
$cron_time explode(",",$rs->fields['day']);

    foreach(
$cron_time as $k=>$v)
    {
        
$selected_time[$k] = "TR_SELECTED_DOM_".$v;
        
$tpl->assign(array($selected_time[$k] => tr('selected') ));
    }

    
$cron_time explode(",",$rs->fields['mon']);

    foreach(
$cron_time as $k=>$v)
    {
        
$selected_time[$k] = "TR_SELECTED_MONTH_".$v;
        
$tpl->assign(array($selected_time[$k] => tr('selected') ));
    }

    
$cron_time explode(",",$rs->fields['dow']);

    foreach(
$cron_time as $k=>$v)
    {
        
$selected_time[$k] = "TR_SELECTED_DOW_".$v;
        
$tpl->assign(array($selected_time[$k] => tr('selected') ));
    }


// End of gen_cron_job();


/*
 *
 * static page messages.
 *
 */

gen_client_mainmenu($tplConfig::get('CLIENT_TEMPLATE_PATH') . '/main_menu_webtools.tpl');
gen_client_menu($tplConfig::get('CLIENT_TEMPLATE_PATH') . '/menu_webtools.tpl');

gen_logged_from($tpl);

check_permissions($tpl);

#    $file_type = array('.php','.php4','.php5','.cgi','.pl','.py'); //List of GOOD files ;-)
$file_type Config::get('CUSTOM_CRON_ALLOWED_EXT'); //List of GOOD files ;-)
    
$file_type explode (","$file_type);
    
$new_value implode (","$file_type);

if (isset(
$_GET['cron_id']) && is_numeric($_GET['cron_id']) && isset($_POST['Submit'])) update_cron_job($tpl$sql$_GET['cron_id'], $_SESSION['user_id'], $min$hour$day_of_month$month$day_of_week$file_type);
    

gen_cron_job($tpl$sql$cron_id$_SESSION['user_id'], $new_value);

$tpl->assign(
    array(
'TR_CRON_MANAGER' => tr('Cronjob Manager'),
        
'TR_EDIT_CRONJOB' => tr('Edit Cronjob'),
        
'TR_NAME' => tr('Name'),
        
'TR_DESCRIPTION' => tr('Description'),
        
'TR_ACTIVE' => tr('Active'),
        
'YES' => tr('Yes'),
        
'NO' => tr('No'),
        
'TR_CRONJOB' => tr('Cronjob'),
        
'TR_COMMAND' => tr('Command to run:'),
        
'TR_MIN' => tr('Minute(s):'),
        
'TR_HOUR' => tr('Hour(s):'),
        
'TR_DAY' => tr('Day(s):'),
        
'TR_MONTHS' => tr('Month(s):'),
        
'TR_WEEKDAYS' => tr('Weekday(s):'),
        
'TR_UPDATE' => tr('Update'),
        
'TR_CANCEL' => tr('Cancel')
        )
    );

gen_page_message($tpl);

$tpl->parse('PAGE''page');
$tpl->prnt();

if (
Config::get('DUMP_GUI_DEBUG'))
    
dump_gui_debug();

unset_messages();

?>

Уффф! Я уж и не чаял заставить эту хрень работать как надо.
Ну я так понимаю можно делать мультиленг нормальный и собирать пакет.
Надеюсь вспомню какие файлы подвергались редакции на лету.
(This post was last modified: 02-06-2010 07:47 PM by data-stream_ru.)
02-06-2010 07:47 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
CronJob Russian Solution - data-stream_ru - 10-16-2009, 11:46 PM
RE: CronJob Russian Solution - server801 - 10-17-2009, 01:00 AM
RE: CronJob Russian Solution - tronix - 10-17-2009, 01:32 AM
RE: CronJob Russian Solution - server801 - 10-17-2009, 04:45 AM
RE: CronJob Russian Solution - tronix - 10-17-2009, 04:50 AM
RE: CronJob Russian Solution - server801 - 10-17-2009, 04:57 AM
RE: CronJob Russian Solution - tronix - 10-17-2009, 05:14 AM
RE: CronJob Russian Solution - tronix - 10-25-2009, 05:35 AM
RE: CronJob Russian Solution - server801 - 10-25-2009, 05:39 AM
RE: CronJob Russian Solution - server801 - 12-05-2009, 08:52 AM
RE: CronJob Russian Solution - server801 - 12-07-2009, 08:33 AM
RE: CronJob Russian Solution - server801 - 12-08-2009, 06:57 PM
RE: CronJob Russian Solution - marchaos - 01-27-2010, 04:15 AM
RE: CronJob Russian Solution - data-stream_ru - 02-06-2010 07:47 PM
RE: CronJob Russian Solution - server801 - 03-19-2010, 07:29 AM
RE: CronJob Russian Solution - webspy - 03-19-2010, 08:36 PM
RE: CronJob Russian Solution - fatalist - 01-06-2011, 08:31 PM
RE: CronJob Russian Solution - beliy - 01-07-2011, 12:12 AM
RE: CronJob Russian Solution - fatalist - 01-08-2011, 12:58 AM
RE: CronJob Russian Solution - beliy - 01-25-2011, 05:24 AM
RE: CronJob Russian Solution - fatalist - 01-25-2011, 09:00 AM
RE: CronJob Russian Solution - beliy - 01-25-2011, 11:24 PM
RE: CronJob Russian Solution - beliy - 01-08-2011, 08:25 PM
RE: CronJob Russian Solution - fatalist - 01-08-2011, 10:42 PM
RE: CronJob Russian Solution - beliy - 01-08-2011, 10:58 PM
RE: CronJob Russian Solution - fatalist - 01-09-2011, 01:23 AM
RE: CronJob Russian Solution - fatalist - 01-09-2011, 07:54 AM
RE: CronJob Russian Solution - beliy - 01-09-2011, 09:44 AM
RE: CronJob Russian Solution - fatalist - 01-09-2011, 09:50 AM
RE: CronJob Russian Solution - fatalist - 01-14-2011, 08:48 PM
RE: CronJob Russian Solution - fatalist - 01-14-2011, 09:05 PM
RE: CronJob Russian Solution - webspy - 01-15-2011, 07:16 AM
RE: CronJob Russian Solution - beliy - 01-29-2011, 12:31 AM
RE: CronJob Russian Solution - beliy - 02-04-2011, 02:42 AM
RE: CronJob Russian Solution - BBK - 02-25-2011, 10:35 PM
RE: CronJob Russian Solution - DragonZX - 11-04-2011, 10:03 PM
RE: CronJob Russian Solution - hn.vc - 12-25-2011, 09:10 AM

Forum Jump:


User(s) browsing this thread: 10 Guest(s)