Example #1
0
}
if (!$v->Validate()) {
    $errors = join('<br />', $v->GetErrors());
    $t->assign('error', $errors);
    $t->display('error-nice.tpl');
    exit;
}
$link = $DB->Row('SELECT * FROM lx_links WHERE link_id=?', array($_REQUEST['link_id']));
if ($link) {
    $status = $C['approve_comments'] ? 'pending' : 'approved';
    $username = $account ? $account['username'] : '';
    $DB->Update('INSERT INTO lx_link_comments VALUES (?,?,?,?,?,?,?,?,?)', array(null, $link['link_id'], $username, $_REQUEST['email'], $_REQUEST['name'], $_SERVER['REMOTE_ADDR'], MYSQL_NOW, $status, $_REQUEST['comment']));
    if ($status == 'approved') {
        $DB->Update('UPDATE lx_links SET comments=comments+1 WHERE link_id=?', array($link['link_id']));
    }
    $_REQUEST['comment_id'] = $DB->InsertID();
    $t->assign_by_ref('comment', $_REQUEST);
    // Send e-mail to appropriate administrators
    $result = $DB->Query('SELECT * FROM lx_administrators');
    while ($admin = $DB->NextRow($result)) {
        if ($admin['notifications'] & E_COMMENT) {
            SendMail($admin['email'], 'email-admin-comment.tpl', $t);
        }
    }
    $DB->Free($result);
    // Clear cache for the link details page
    if ($status == 'approved') {
        $t->cache_dir = 'templates/cache_details';
        $t->clear_cache('directory-link-details.tpl', md5($link['link_id']));
    }
}
Example #2
0
    echo "This scanner configuration is already running\n";
    exit;
}
// Clear previous scan results
$DB->Update('DELETE FROM `tlx_scanner_results` WHERE `config_id`=?', array($config_id));
// Set the last run time, pid, and status
$DB->Update('UPDATE `tlx_scanner_configs` SET `current_status`=?,`status_updated`=?,`date_last_run`=?,`pid`=? WHERE `config_id`=?', array('Starting...', time(), MYSQL_NOW, getmypid(), $config_id));
// Setup the MySQL query
$s =& GenerateQuery();
// Get the galleries to scan
$result = $DB->Query($s->Generate(), $s->binds);
$current_account = 0;
$total_accounts = $DB->NumRows($result);
// Create history entry
$DB->Update('INSERT INTO `tlx_scanner_history` VALUES (?,?,?,?,?,?,?,?,?,?)', array(null, $config_id, MYSQL_NOW, null, $total_accounts, 0, 0, 0, 0, 0));
$history_id = $DB->InsertID();
if ($total_accounts == 0) {
    $DB->Update('UPDATE `tlx_scanner_configs` SET `current_status`=?,`status_updated`=? WHERE `config_id`=?', array("No accounts to scan - exiting", time(), $config_id));
    sleep(10);
}
while ($account = $DB->NextRow($result)) {
    $exception = 0x0;
    $current_account++;
    // Exit if stopped (pid set to 0)
    $pid = $DB->Count('SELECT `pid` FROM `tlx_scanner_configs` WHERE `config_id`=?', array($config_id));
    if ($pid == 0) {
        break;
    }
    // Update scanner status
    $DB->Update('UPDATE `tlx_scanner_configs` SET `current_status`=?,`status_updated`=? WHERE `config_id`=?', array("Scanning account {$current_account} of {$total_accounts}", time(), $config_id));
    // Update history