Current time: 09-27-2024, 10:51 PM Hello There, Guest! (LoginRegister)


Thread Closed 
[HowTO] add cronjob on Debian Lenny Improved
Author Message
MasterTH Offline
Member
***

Posts: 570
Joined: Feb 2009
Reputation: 4
Post: #22
RE: [HowTO] add cronjob on Debian Lenny Improved
restarted the service everytime to get the new config running Wink
The id field is int(10) and root has every rights to every database..

Here is my 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.
*
*
* Modified on 29-12-2009 by xtc007
* Functionality added : fixed white square display in top on 1.0.3
* RT Media Inc ~ www.rtmedia.ca
*
*/

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

check_login(__FILE__);

$tpl = new pTemplate();
$tpl->define_dynamic('page', Config::get('CLIENT_TEMPLATE_PATH') . '/cronjobs_overview.tpl');
$tpl->define_dynamic('page_message', 'page');
$tpl->define_dynamic('logged_from', 'page');
$tpl->define_dynamic('cronjobs', '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'])
        )
    );

# Getting user's right to reading and using  the Jobs





function gen_cron_user(&$tpl, &$sql, $domain) {
#
}

function gen_cron_jobs(&$tpl, &$sql, $user_id) {

    $query = <<<SQL_QUERY
        SELECT
            id, name, lastrun, activ, coment, domain
        FROM
            hcrondtab
        WHERE
            domain = $user_id
        ORDER BY
            id
SQL_QUERY;

    $rs = exec_query($sql, $query, array($user_id));

    if ($rs->RecordCount() == 0) {
        $tpl->assign(
            array('NAME' => tr('Jobs list is empty!'),
                'DESCRIPTION' => '',
                'ACTIVE' => '',
                'LASTRUN' => '',
                'EDIT' => '',
                'DELETE' => ''
                )
            );

    } else {

        $counter = 0;
        while (!$rs->EOF) {
            if ($counter % 2 == 0) {
                $tpl->assign('ITEM_CLASS', 'content');
            } else {
                $tpl->assign('ITEM_CLASS', 'content2');
            }

            if ($rs->fields['activ'] == 1) {$activ = 'Yes';}
            else {$activ = 'No';};
            $lastrun = $rs->fields['lastrun'];
            if ($lastrun == 0 ) {$lastrun = '';}
                else {$lastrun = date("Y-m-d H:i:s",$lastrun);}
            $tpl->assign(
                array('NAME' => $rs->fields['name'],
                    'DESCRIPTION' => $rs->fields['coment'],
                    'LASTRUN' => $lastrun,
                    'ACTIVE' => $activ,
                    'ID'  => $rs->fields['id'],
                    'EDIT' => '<img src="{THEME_COLOR_PATH}/images/icons/edit.png" width="16" height="16" align="absmiddle"> <a href="cronjobs_edit.php?cron_id={ID}" class="link">{TR_EDIT}</a>',
                    'DELETE' => '<img src="{THEME_COLOR_PATH}/images/icons/delete.png" width="16" height="16" border="0" align="absmiddle"> <a href="#" class="link" onclick="action_delete(\'cronjobs_delete.php?cron_id={ID}\', \'{NAME}\')">{TR_DELETE}</a>'
                    )
                );
            $tpl->parse('CRONJOBS', '.cronjobs');
            $rs->MoveNext();
            $counter++;
        }

    }

} // End of gen_cron_job();

/*
*
* static page messages.
*
*/

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

gen_logged_from($tpl);

check_permissions($tpl);

gen_cron_jobs($tpl, $sql, $_SESSION['user_id']);

$tpl->assign(
    array('TR_CRON_MANAGER' => tr('Cronjob Manager'),
        'TR_MESSAGE_DELETE' => tr('Are you sure you want to delete %s?', true, '%s'),
        'TR_CRONJOBS' => tr('Cronjobs'),
        'TR_ACTIVE' => tr('Active'),
        'TR_ACTION' => tr('Active'),
        'TR_EDIT' => tr('Edit'),
        'TR_DELETE' => tr('Delete'),
        'TR_ADD' => tr('Add Cronjob')
        )
    );

gen_page_message($tpl);

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

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

unset_messages();

?>

a screenshot from table is attached


Attached File(s) Thumbnail(s)
   
(This post was last modified: 01-07-2010 03:21 PM by MasterTH.)
01-07-2010 03:19 PM
Find all posts by this user
Thread Closed 


Messages In This Thread
blank page after instalation - pandjie - 06-05-2011, 11:43 AM
RE: blank page after instalation - mr.x - 06-05-2011, 04:20 PM
RE: [HowTO] add cronjob on Debian Lenny Improved - MasterTH - 01-07-2010 03:19 PM

Forum Jump:


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