$tpl2->set('s', 'ERRORS_CATNAME', $aRow[$i]['namecat']);
         $tpl2->set('s', 'ERRORS_CATNAME_SHORT', substr($aRow[$i]['namecat'], 0, 20) . (strlen($aRow[$i]['namecat']) > 20 ? ' ...' : ''));
         $tpl2->set('s', 'MODE', $_GET['mode']);
         $tpl2->set('s', 'URL', $aUrl['contenido']);
         $tpl2->set('s', 'SID', $sess->id);
         if ($aRow[$i]['error_type'] == "unknown") {
             $tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("Unknown: articles, documents etc. do not exist.", $plugin_name));
         } elseif ($aRow[$i]['error_type'] == "offline") {
             $tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("Offline: article or category is offline.", $plugin_name));
         } elseif ($aRow[$i]['error_type'] == "startart") {
             $tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("Offline: article or category is offline.", $plugin_name));
         } elseif ($aRow[$i]['error_type'] == "dbfs") {
             $tpl2->set('s', 'ERRORS_ERROR_TYPE_HELP', i18n("dbfs: no matches found in the dbfs database.", $plugin_name));
         }
         if ($sKey != "cat") {
             $aError_output[$sKey] .= $tpl2->generate($cfg['templates']['linkchecker_test_errors'], 1);
         } else {
             $aError_output[$sKey] .= $tpl2->generate($cfg['templates']['linkchecker_test_errors_cat'], 1);
             // special template for idcats
         }
     }
 }
 /* Counter */
 if ($iCounter = $oCache->get($aCacheName['errorscount'], intval($_GET['mode']))) {
     // Cache exists?
     $iErrors_count_checked = $iCounter;
 } else {
     // Count searched links: idarts + idcats + idcatarts + others
     $iErrors_count_checked = count($aSearchIDInfosArt) + count($aSearchIDInfosCat) + count($aSearchIDInfosCatArt) + count($aSearchIDInfosNonID);
 }
 // Count errors
$oPagerLink->setCustom("filter", "");
$oPagerLink->setCustom("sortby", "name");
$oPagerLink->setCustom("sortorder", "ASC");
$oPagerLink->setCustom("searchin", "--all--");
$oPagerLink->setCustom("frame", "2");
$oPagerLink->setCustom("area", "recipientgroups");
$oPagerLink->enableAutomaticParameterAppend();
$oPagerLink->setCustom("contenido", $sess->id);
// To template
$sLink = "paginggroup";
$oTpl->set('s', 'PAGINGLINKGROUP', $sLink);
//$oPagerRow = new cObjectPager("0ed6d632-6adf-4f09-a0c6-1e38ab60e305", $iItemCount, $iItemsPerPage, 1, $oPagerLink, "page", $sLink);
$oPagerRow = new cObjectPager("0ed6d632-6adf-4f09-a0c6-1e38ab60e305", 0, 1, 1, $oPagerLink, 'page', $sLink);
######################################
# Recipient Groups: Container
######################################
$sContainerId = 'cont_recipientgroup';
$sContainer = '<div id="' . $sContainerId . '">';
$sContainer .= '<table border="0" cellspacing="0" cellpadding="0" width="100%">';
if ($perm->have_perm_area_action("recipientgroups", "recipientgroup_create")) {
    $sContainer .= $oListActionsRow->render();
}
$sContainer .= $oListOptionsRow->render();
$sContainer .= $oPagerRow->render();
$sContainer .= '</table>';
$sContainer .= '</div>';
$oTpl->set('s', 'CRECIPIENTGROUP', $sContainer);
$oTpl->set('s', 'ID_CRECIPIENTGROUP', $sContainerId);
$oTpl->set('s', 'SESSID', $sess->id);
$oTpl->generate($cfg['path']['templates'] . $cfg['templates']['newsletter_left_top']);
$sFile = $_GET['file'];
$iLine = intval($_GET['line']);
$sWait = $_GET['wait'];
$sProcessed = $_GET['processed'];
$contenido = $_GET['contenido'];
# Defines
$plugin_name = 'db_backup';
# Execution
$ret = restore_tables($cfg['path']['contenido'] . 'data/backup/' . $sFile, $iLine);
if (is_int($ret)) {
    $oTpl = new Template();
    $oTpl->set('s', 'PATH', $cfg['path']['contenido_fullhtml']);
    $oTpl->set('s', 'LABEL_WAIT', $sWait . '&hellip;');
    $oTpl->set('s', 'MESSAGE', $sProcessed . ': ' . $ret);
    $oTpl->set('s', 'SCRIPT', 'document.location.href="' . $cfg['path']['contenido_fullhtml'] . 'plugins/db_backup/includes/ajax.restore.php?mode=1&action=2&file=' . $sFile . '&start=' . $fStart . '&line=' . $ret . '&wait=' . $sWait . '&processed=' . $sProcessed . '&contenido=' . $contenido . '";');
    $oTpl->generate($cfg[$plugin_name]['templates']['ajax_restore']);
} else {
    echo '<script type="text/javascript">document.location.href="' . $cfg['path']['contenido_fullhtml'] . 'main.php?area=' . $plugin_name . '&frame=4&mode=1&action=2&file=' . $sFile . '&start=' . $fStart . '&result=' . ($ret ? 'true' : 'false') . '&contenido=' . $contenido . '";</script>';
}
# functions
function restore_tables($file, $first_line = 0)
{
    global $cfg;
    $iStart = time();
    $iMET = 2;
    #(intval(ini_get('max_execution_time')) - 10); # We need some time for other tasks
    $db = new DB_Contenido();
    $current_line = 0;
    # Open the backup file
    $gz = substr($file, -3) == '.gz';
    $len = filesize($file);
function getActionSelect($idartlang, $idusersequence)
{
    global $cfg;
    $workflowActions = new WorkflowActions();
    $allActions = $workflowActions->getAvailableWorkflowActions();
    $wfSelect = new Template();
    $wfSelect->set('s', 'NAME', 'wfselect' . $idartlang);
    $wfSelect->set('s', 'CLASS', 'text_medium');
    $userSequence = new WorkflowUserSequence();
    $userSequence->loadByPrimaryKey($idusersequence);
    $workflowItem = $userSequence->getWorkflowItem();
    if ($workflowItem === false) {
        return;
    }
    $wfRights = $workflowItem->getStepRights();
    $artAllocation = new WorkflowArtAllocations();
    $artAllocation->select("idartlang = '{$idartlang}'");
    if ($obj = $artAllocation->next()) {
        $laststep = $obj->get("lastusersequence");
    }
    $bExistOption = false;
    if ($laststep != $idusersequence) {
        $wfSelect->set('d', 'VALUE', 'next');
        $wfSelect->set('d', 'CAPTION', i18n("Confirm", "workflow"));
        $wfSelect->set('d', 'SELECTED', 'SELECTED');
        $wfSelect->next();
        $bExistOption = true;
    }
    if ($wfRights["last"] == true) {
        $wfSelect->set('d', 'VALUE', 'last');
        $wfSelect->set('d', 'CAPTION', i18n("Back to last editor", "workflow"));
        $wfSelect->set('d', 'SELECTED', '');
        $wfSelect->next();
        $bExistOption = true;
    }
    if ($wfRights["reject"] == true) {
        $wfSelect->set('d', 'VALUE', 'reject');
        $wfSelect->set('d', 'CAPTION', i18n("Reject article", "workflow"));
        $wfSelect->set('d', 'SELECTED', '');
        $wfSelect->next();
        $bExistOption = true;
    }
    if ($wfRights["revise"] == true) {
        $wfSelect->set('d', 'VALUE', 'revise');
        $wfSelect->set('d', 'CAPTION', i18n("Revise article", "workflow"));
        $wfSelect->set('d', 'SELECTED', '');
        $wfSelect->next();
        $bExistOption = true;
    }
    if ($bExistOption) {
        return $wfSelect->generate($cfg['path']['templates'] . $cfg['templates']['generic_select'], true);
    } else {
        return false;
    }
}
// Template-definition
$tpl->set('s', 'CONTENIDO_URL', $cfg['path']['contenido_fullhtml']);
$tpl->set('s', 'SID', $sess->id);
/* Whitelist: Delete */
if (!empty($_GET['url_to_delete'])) {
    $sql = "DELETE FROM " . $cfg['tab']['whitelist'] . " WHERE url = '" . Contenido_Security::escapeDB(base64_decode($_GET['url_to_delete']), $db) . "'";
    $db->query($sql);
}
// Get whitelist
$sql = "SELECT url, lastview FROM " . $cfg['tab']['whitelist'] . " WHERE lastview < " . (time() + $iWhitelist_timeout) . "\n\t\tAND lastview > " . (time() - $iWhitelist_timeout) . " ORDER BY lastview DESC";
$db->query($sql);
while ($db->next_record()) {
    $tpl2 = new Template();
    $tpl2->reset();
    $tpl2->set('s', 'CONTENIDO_URL', $cfg['path']['contenido_fullhtml']);
    $tpl2->set('s', 'SID', $sess->id);
    $tpl2->set('s', 'URL', $db->f("url"));
    $tpl2->set('s', 'URL_ENCODE', base64_encode($db->f("url")));
    $tpl2->set('s', 'ENTRY', strftime(i18n('%Y-%m-%d, %I:%M%S %p', $plugin_name), $db->f("lastview")));
    $aWhitelist .= $tpl2->generate($cfg['templates']['linkchecker_whitelist_urls'], 1);
}
// Template- and languagevars
$tpl->set('s', 'HEADLINE', i18n("Links at whitelist", $plugin_name));
$tpl->set('s', 'HEADLINE_DELETE', i18n("Delete", $plugin_name));
$tpl->set('s', 'HEADLINE_ENTRY', i18n("Entry", $plugin_name));
$tpl->set('s', 'HEADLINE_URLS', i18n("URLs", $plugin_name));
$tpl->set('s', 'HELP', i18n("This links are on the whitelist. Whitelist-links won't be check at linkchecker.", $plugin_name));
$tpl->set('s', 'TITLE', "Whitelist");
$tpl->set('s', 'WHITELIST', $aWhitelist);
$tpl->set('s', 'WHITELIST_COUNT', $db->num_rows());
$tpl->generate($cfg['templates']['linkchecker_whitelist']);
    $result = $notification->returnNotification("warning", i18n('There is no Content Allocation tree.', 'content_allocation'));
} else {
    if (!is_object($tpl)) {
        $tpl = new Template();
    }
    $hiddenfields = '<input type="hidden" name="action" value="storeallocation">
		<input type="hidden" name="idart" value="' . $idart . '">
		<input type="hidden" name="contenido" value="' . $sess->id . '">
		<input type="hidden" name="area" value="' . $area . '">
		<input type="hidden" name="frame" value="' . $frame . '">
		<input type="hidden" name="idcat" value="' . $idcat . '">';
    $tpl->set('s', 'HIDDENFIELDS', $hiddenfields);
    if (sizeof($loadedAllocations) > 0) {
        $tpl->set('s', 'ARRAY_CHECKED_BOXES', 'var checkedBoxes = [' . implode(',', $loadedAllocations) . '];');
    } else {
        $tpl->set('s', 'ARRAY_CHECKED_BOXES', 'var checkedBoxes = [];');
    }
    $oDiv = new cHTMLDiv();
    $oDiv->updateAttributes(array('style' => 'text-align: right; padding: 5px; width: 730px; border: 1px #B3B3B3 solid; background-color: #FFFFFF;'));
    $oDiv->setContent('<input type="image" src="images/but_ok.gif" />');
    $tpl->set('s', 'DIV', '<br>' . $oDiv->render());
    $tpl->set('s', 'TREE', $result);
    $tpl->set('s', 'REMOVE_ALL', i18n("Remove all", 'content_allocation'));
    $tpl->set('s', 'REMOVE', i18n("Remove", 'content_allocation'));
    $result = $tpl->generate($cfg['pica']['treetemplate_complexlist'], true);
    $script = '<link rel="stylesheet" type="text/css" href="' . $cfg['pica']['style_complexlist'] . '"/>
	<script language="javascript" src="' . $cfg['pica']['script_complexlist'] . '"></script>';
    $oPage->addScript('style', $script);
}
$oPage->setContent($sLocationString . $result . markSubMenuItem(5, true));
$oPage->render();
function getTimeUnitSelector($listid, $default)
{
    global $idclient, $cfg, $auth;
    $timeunits = array();
    $timeunits['Seconds'] = i18n("Seconds", "workflow");
    $timeunits['Minutes'] = i18n("Minutes", "workflow");
    $timeunits['Hours'] = i18n("Hours", "workflow");
    $timeunits['Days'] = i18n("Days", "workflow");
    $timeunits['Weeks'] = i18n("Weeks", "workflow");
    $timeunits['Months'] = i18n("Months", "workflow");
    $timeunits['Years'] = i18n("Years", "workflow");
    $tpl2 = new Template();
    $tpl2->set('s', 'NAME', 'time' . $listid);
    $tpl2->set('s', 'CLASS', 'text_small');
    $tpl2->set('s', 'OPTIONS', 'size=1');
    foreach ($timeunits as $key => $value) {
        $tpl2->set('d', 'VALUE', $key);
        $tpl2->set('d', 'CAPTION', $value);
        if ($default == $key) {
            $tpl2->set('d', 'SELECTED', 'SELECTED');
        } else {
            $tpl2->set('d', 'SELECTED', '');
        }
        $tpl2->next();
    }
    return $tpl2->generate($cfg['path']['templates'] . $cfg['templates']['generic_select'], true);
}
if (!$perm->have_perm_area_action($plugin_name, $plugin_name) && !$cronjob) {
    exit;
}
$plugin_name = "db_backup";
plugin_include($plugin_name, 'includes/config.plugin.php');
$oTpl = new Template();
# Check for the requirements
if (!$pathfinder || !$permissionfinder) {
    $oTpl->set('s', 'HEADLINE', i18n("Configuration", $plugin_name));
    $oTpl->set('s', 'INTRO', i18n("Backup requires a folder named 'backup' in /drugcms/data/ with write permission for the web server user.", $plugin_name));
    $oTpl->set('s', 'LABEL_SETTINGS', i18n("Current settings", $plugin_name));
    $oTpl->set('s', 'LABEL_PATHFINDER', i18n("Backup folder", $plugin_name));
    $oTpl->set('s', 'PATHFINDER', $pathfinder ? i18n("The backup folder exists", $plugin_name) : i18n("The backup folder doesn't exist, please create it", $plugin_name));
    $oTpl->set('s', 'LABEL_CHMOD', i18n("Folder permissions", $plugin_name));
    $oTpl->set('s', 'CHMOD', $permissionfinder ? i18n("Write permission granted", $plugin_name) : i18n("Write permission denied", $plugin_name));
    $oTpl->generate($cfg[$plugin_name]['templates']['config']);
} else {
    switch (intval($_GET['action'])) {
        case 1:
            $fStart = isset($_GET['start']) ? floatval($_GET['start']) : microtime(true);
            $sFile = isset($_GET['file']) ? $_GET['file'] : $contenido_database . '_' . date("Y\\-m\\-d\\_H\\-i\\-s", time()) . '.sql';
            $ret = backup_tables($backup_path . $sFile, $contenido_host, $contenido_user, $contenido_password, $contenido_database, $_GET['table'], intval($_GET['row']));
            if (is_array($ret)) {
                $oTpl->set('s', 'PATH', $cfg['path']['contenido_fullhtml']);
                $oTpl->set('s', 'LABEL_WAIT', i18n("Please wait", $plugin_name) . '&hellip;');
                $oTpl->set('s', 'MESSAGE', i18n("Current table", $plugin_name) . ': ' . $ret['table'] . '<br />' . i18n("Current row", $plugin_name) . ': ' . $ret['row']);
                $oTpl->set('s', 'SCRIPT', 'document.location.href="' . $sess->url('main.php?area=' . $plugin_name . '&frame=4&mode=0&action=1&file=' . $sFile . '&start=' . $fStart . '&table=' . $ret['table'] . '&row=' . $ret['row']) . '";');
                $oTpl->generate($cfg[$plugin_name]['templates']['ajax_backup']);
                die;
            } elseif ($ret === true) {
                $sMsg = '<div style="margin-bottom: 2px; padding: 2px 0px 4px 0px; font-weight: bold; text-align: center; color: #FFF; background-color: #62BC47; border: 2px solid #080;">' . i18n("Backup created successfully", $plugin_name) . '</div>';
Example #9
0
                // no-break on purpose!
                case 'wdisappear':
                    $frame['display'] = $row['content'];
                    $frame['msg'] = 'Warning ' . ($row['content'] == 'wappear' ? 'appeared' : 'disappeared') . '.';
                    break;
                case 'beginblink':
                    $frame['blink'] = true;
                    $frame['msg'] = 'Warning blinked!';
                    break;
                case 'opt1':
                case 'opt2':
                case 'opt3':
                    $frame['msg'] = 'Option ' . substr($row['content'], 3) . ' clicked.';
                    break;
                default:
                    $frame['msg'] = $row['content'];
                    break;
            }
            break;
    }
    if ($frame['msg']) {
        $frame['msg'] = "&#9679; " . $frame['msg'];
    }
    $frames[] = $frame;
}
$data->assign('frames', $frames);
$c->common->addContent($data->generate());
$c->common->addCSSRef(APP_URL . 'files/wrap.css.php');
$c->common->addScriptRef(APP_URL . 'files/wrap.js');
$c->common->addOnload("maxtime=" . ($cols['tmax'] - $cols['tmin']) . "; wrapanimate();");
$c->display();