/**
  * initialize module with request datas
  * 
  * @param object request
  * @return void
  */
 function init(&$request, $o_tpl = null, $o_archive = null)
 {
     if (!is_a($o_tpl, "TemplateEngine")) {
         $o_tpl = null;
     }
     parent::init($request, $o_tpl);
     $date = $this->request->getDate();
     if (is_null($this->data)) {
         if (is_null($o_archive)) {
             $o_archive = DataModel::getArchive($this->site, $date, $this->request->getPeriod());
         }
         $this->data = new DataModel($o_archive, $this->request);
     }
     $d = new Date(getDateFromTimestamp(time()));
     if (($this->data->archive->date->get() == $d->get() || isset($this->disableCache)) && is_a($this->tpl, "TemplateEngine")) {
         printDebug("Current date asked is today's date, cache not activated<br>");
         $this->tpl->caching = 0;
     }
 }
 function setTimestamp($ts)
 {
     $this->loadInfo(getDateFromTimestamp($ts));
 }
 /**
  * Returns limit of the period periodType containing $s_date
  * Works with weeks, month, years, and misc periods (in this case, minDate is the first day where there are logs)
  * 
  * @param string $s_date 
  */
 function getPeriodDatesLimit($s_date)
 {
     // objects
     $date = new Date($s_date);
     $minDate = $this->site->getMinDay();
     $date = $this->offsetDate($date);
     //print("MinDate is ".$minDate->get()."<br>Date asked is $s_date<br>Date after Offset is ".$date->get()."<br>");
     switch ($this->periodType) {
         case DB_ARCHIVES_PERIOD_MONTH:
             // detect min day for the month
             // if the minimum date month is different, we surely take the whole month
             if ($minDate->getMonth() == $date->getMonth() && $minDate->getYear() == $date->getYear()) {
                 $minDateForSure = $minDate->get();
             } else {
                 $minDateForSure = $date->getYear() . "-" . $date->getMonth() . "-01";
             }
             // detect max date for the month
             // if month asked is the current month then max day is today, else its the last day of the month
             if ($date->getMonth() == date("m") && $date->getYear() == date("Y")) {
                 // if today is the first day of the month, don't say
                 // "yesterday is the last day of the month"
                 // but "today is the only day of the month"
                 if (date("j", time()) == 1) {
                     $maxDateForSure = getDateFromTimestamp(time());
                 } else {
                     $maxDateForSure = getDateFromTimestamp(time() - 86400);
                 }
             } else {
                 $maxDateForSure = $date->getYear() . "-" . $date->getMonth() . "-" . date("t", $date->getTimestamp());
             }
             break;
         case DB_ARCHIVES_PERIOD_WEEK:
             $time = $date->getTimestamp();
             // detect beginning of the week
             while (date("W", $time - 86400) == $date->getWeek() && $time - 86400 >= $minDate->getTimestamp()) {
                 $time -= 86400;
             }
             $minDateForSure = getDateFromTimestamp($time);
             // end of week
             while (date("W", $time + 86400) == $date->getWeek() && $time + 86400 <= time()) {
                 $time += 86400;
             }
             $maxDateForSure = getDateFromTimestamp($time);
             break;
         case DB_ARCHIVES_PERIOD_MISC_PERIOD:
             $minDateForSure = $minDate->get();
             $maxDateForSure = $date->get();
             break;
         case DB_ARCHIVES_PERIOD_YEAR:
             // min is minDate if year common
             if ($date->getYear() == date("Y", $minDate->getYear())) {
                 $minDateForSure = $minDate->get();
             } else {
                 $minDateForSure = $date->getYear() . "-01-01";
             }
             // max date is today if year is current year
             if ($date->getYear() == date("Y")) {
                 $maxDateForSure = getDateFromTimestamp(time());
             } else {
                 $maxDateForSure = $date->getYear() . "-12-31";
             }
             break;
         default:
             break;
     }
     $this->date = new Date($minDateForSure);
     $this->date2 = new Date($maxDateForSure);
     //print("max=$maxDateForSure <br> ".$this->date->get().",". $this->date2->get()."<br>");
     $this->date = $this->offsetDate($this->date);
     $this->date2 = $this->offsetDate($this->date2);
 }
 function loadDate()
 {
     $this->date = getRequestVar('date', getDateFromTimestamp(time() - (DEFAULT_DAY_TODAY ? 0 : 86400)), 'string');
 }
 /**
  * loads info about the first day of log
  * 
  * @return object
  */
 function loadMinDay()
 {
     $firstDate = getDateFromTimestamp(time());
     $db =& Db::getInstance();
     if (!$db->isReady() || !$db->areAllTablesInstalled()) {
         $this->minDay = new Date($firstDate);
         return false;
     }
     $siteFirstDate = array();
     $fileAdress = INCLUDE_PATH . "/config/site_first_date.php";
     if (is_file($fileAdress)) {
         require $fileAdress;
     }
     if (!isset($siteFirstDate[$this->id])) {
         $r = query("SELECT date1\n\t\t\t\t\t\tFROM " . T_ARCHIVES . "\n\t\t\t\t\t\tWHERE period = " . DB_ARCHIVES_PERIOD_DAY . "\n\t\t\t\t  \t\tAND idsite = " . $this->getId() . "\n\t\t\t\t\t\tORDER BY date1 ASC\n\t\t\t\t\t\tLIMIT 1\n\t\t\t\t\t\t");
         if (mysql_num_rows($r) === 0) {
             $r2 = query("SELECT server_date" . " FROM " . T_VISIT . "\n\t\t\t\t  WHERE idsite = " . $this->getId() . " LIMIT 1");
             if (mysql_num_rows($r2) === 0) {
                 if (!isset($GLOBALS['sitePrinted'][$this->id])) {
                     //print($GLOBALS['lang']['generique_aucune_visite_bdd'] .
                     //		"<br><b>Site: ".$this->getName()." (id=".$this->id.")</b><br><br>");
                     $GLOBALS['sitePrinted'][$this->id] = true;
                 }
             } else {
                 $l = mysql_fetch_assoc($r2);
                 $firstDate = $l['server_date'];
             }
         } else {
             $l = mysql_fetch_assoc($r);
             $firstDate = $l['date1'];
         }
         $o_firstDate = new Date($firstDate);
         if ($o_firstDate->getTimestamp() > time()) {
             $firstDate = getDateFromTimestamp(time());
         }
         $siteFirstDate[$this->id] = $firstDate;
         // save new info in config file
         saveConfigFile($fileAdress, $siteFirstDate, 'siteFirstDate');
     } else {
         $firstDate = $siteFirstDate[$this->id];
     }
     $this->minDay = new Date($firstDate);
     return true;
 }
if (is_file($crontabFile)) {
    include $crontabFile;
}
if (WEB_CRONTAB && is_writable($crontabFile) && ((!isset($crontab) || $crontab['date_last_success'] != getDateFromTimestamp(time())) && (!is_file($crontabFile) || isset($crontab) && $crontab['time_last_try'] < time() - TIME_TO_WAIT_FOR_PARALLEL_ARCHIVE))) {
    $crontab['time_last_try'] = time();
    $crontab['date_last_success'] = '2000-12-31';
    saveConfigFile($crontabFile, $crontab, "crontab");
    printDebug('==========================<br>
				CRONTAB BEGIN/			  <br>
				==========================<br>
				');
    require_once INCLUDE_PATH . '/core/include/PmvConfig.class.php';
    require_once INCLUDE_PATH . '/core/include/ApplicationController.php';
    $r =& Request::getInstance();
    $r->setModuleName('send_mail');
    $r->setCrontabAllowed();
    ApplicationController::init();
    printDebug('==========================<br>
				CRONTAB END/			  <br>
				==========================<br>
				');
    $crontab['date_last_success'] = getDateFromTimestamp(time());
    saveConfigFile($crontabFile, $crontab, "crontab");
}
$db->close();
redirectToUrlIfNecessary();
loadImage($logo, $idSite);
// flush content for display
if (DEBUG) {
    ob_end_flush();
}
/**
 * returns an array containing the days between the 2 days
 * 
 * @param string $s_date1
 * @param string $s_date2
 * 
 * @return array 
 */
function getDaysBetween($s_date1, $s_date2)
{
    $date1 = new Date($s_date1);
    $date2 = new Date($s_date2);
    $ts1 = $date1->getTimestamp();
    $ts2 = $date2->getTimestamp();
    //print("(".$date1->get()." > ".$date2->get().")");
    if ($ts1 > $ts2) {
        trigger_error("For the period statistic, Day 1 is AFTER Day 2 (" . $date1->get() . " > " . $date2->get() . "). It's impossible, sorry.", E_USER_ERROR);
    }
    $return = array();
    while ($ts1 <= $ts2) {
        $return[] = getDateFromTimestamp($ts1);
        $ts1 = mktime(23, 59, 59, date("m", $ts1), date("d", $ts1) + 1, date("Y", $ts1));
    }
    return $return;
}
    function showAll()
    {
        $this->tpl->setMainTemplate("structure_mail.tpl");
        $this->request->setModuleName('view_visits_rss');
        $allSiteArchive = DataModel::getSites();
        /**
         * Cache Lite
         */
        $options = array('cacheDir' => DIR_CACHE_MAIL, 'lifeTime' => CACHE_MAIL_LIFETIME);
        $Cache_Lite = new Cache_Lite($options);
        $lang =& Lang::getInstance();
        // case update to 2.2RC1 without executing global info
        if (!defined('INTERFACE_DEFAULT_LANG')) {
            define('INTERFACE_DEFAULT_LANG', 'en-utf-8.php');
        }
        $lang->setNewLang(INTERFACE_DEFAULT_LANG);
        /**
         * Compute mails
         */
        $o_config =& PmvConfig::getInstance();
        foreach ($allSiteArchive as $infoSite) {
            /**
             * php Mailer
             */
            $mail = new MyMailer();
            $mail->IsHTML(true);
            $imgUrl = INCLUDE_PATH . "/themes/default/images/phpmv.png";
            $mail->AddEmbeddedImage($imgUrl, "my-attach", $GLOBALS['lang']['logo_description'], "base64", "image/png");
            $uniqCacheId = md5(serialize($infoSite) . date("Y-m-d")) . '.mail';
            // Test if thereis a valide cache for this id
            if (true) {
                $o_mod = new ViewVisitsRss($infoSite);
                $this->request->date = getDateFromTimestamp(time() - 86400);
                $o_mod->init($this->request);
                $dateLiteral = $o_mod->data->archive->getLiteralDate();
                $body = '<html xml:lang="fr" >
						<head>
							<meta http-equiv="content-type" content="text/html; charset=utf-8" />
						</head>
						
						<body>
						';
                $body .= $o_mod->showAll(true, true);
                $body .= '</body></html>';
                $textBody = strip_tags($body);
                $subject = vsprintf($GLOBALS['lang']['rss_titre'], array($infoSite->getName(), $dateLiteral));
                print "<br>Subject : {$subject}<hr>";
                print "<br>Content : {$body}<hr>";
                //$Cache_Lite->save($body);
            }
            $mail->Subject = $subject;
            $mail->Body = $body;
            $mail->AltBody = $textBody;
            $mail->CharSet = $GLOBALS['lang']['charset'];
            $user = new UserConfigDb();
            $groups = $user->getGroups();
            $users = array_merge(array(0 => array('email' => SU_EMAIL, 'alias' => 'phpMyVisites Administrator', 'send_mail' => SEND_MAIL == "yes" ? 1 : 0)), $user->getUserByGroup(1, $infoSite->getId()), $user->getUserByGroup(2, $infoSite->getId()));
            // we send all emails once
            $emailsToSend_infos = array('object' => $mail, 'to' => array());
            // add recipients for the mail
            foreach ($users as $userInfo) {
                //print_r($userInfo);
                if (!empty($userInfo['email']) && $userInfo['send_mail'] == 1) {
                    $emailsToSend_infos['to'][] = array($userInfo['email'], $userInfo['alias']);
                }
            }
            $emailsToSend[] = $emailsToSend_infos;
        }
        // send all emails
        foreach ($emailsToSend as $currMail) {
            $mail =& $currMail['object'];
            foreach ($currMail['to'] as $recipient) {
                $mail->AddAddress($recipient[0], $recipient[1]);
                if (!@$mail->Send()) {
                    echo "<u><b>There was an error sending the message to " . $userInfo['email'] . "</u></b><br>";
                } else {
                    echo "<u><b>Message was sent successfully to " . $userInfo['email'] . "</u></b><br>";
                }
                $mail->ClearAddresses();
            }
        }
    }
Example #9
0
 function init()
 {
     global $MOD_TITLE, $MOD_GROUP, $MOD_VISIBLE, $MOD_SUBMENU;
     parent::init($MOD_TITLE, $MOD_GROUP, $MOD_VISIBLE);
     // получаем список лицевых счетов абонента
     $this->accounts = array();
     $this->urfa->call(-16469);
     $this->urfa->send();
     // получаем количество записей
     $count = $this->urfa->get_int();
     for ($i = 0; $i < $count; $i++) {
         $aid = $this->urfa->get_int();
         // номер лицевого счета
         // пропускаем два неинтересных нам параметра
         $this->urfa->get_double();
         // денег на счету
         $this->urfa->get_double();
         // ??
         // добавлем в списков лицевых счетов
         $this->accounts[$aid] = $aid;
     }
     $this->urfa->finish();
     if (isset($_REQUEST['Status'])) {
         $status = $_REQUEST['Status'];
     } else {
         $status = '';
     }
     if ($status == 'pay') {
         // получаем информацию о текущем пользователе
         $this->user = array();
         $this->urfa->call(-0x4052);
         $this->urfa->send();
         $this->user['id'] = $this->urfa->get_int();
         $this->user['login'] = $this->urfa->get_string();
         $this->user['basic_account'] = $this->urfa->get_int();
         $this->user['balance'] = roundDouble($this->urfa->get_double());
         $this->user['credit'] = roundDouble($this->urfa->get_double());
         $this->user['is_blocked'] = resolveBlockState($this->urfa->get_int());
         $this->user['create_date'] = getDateFromTimestamp($this->urfa->get_int());
         $this->user['last_change_date'] = getDateFromTimestamp($this->urfa->get_int());
         $this->user['who_create'] = resolveUserName($this->urfa->get_int());
         $this->user['who_change'] = resolveUserName($this->urfa->get_int());
         $this->user['is_juridical'] = $this->urfa->get_int();
         $this->user['full_name'] = $this->urfa->get_string();
         $accountId = intval($_REQUEST["AccountId"]);
         // проверка введенного значения суммы оплаты
         $subtotal_P = $_REQUEST['OutSum'];
         $subtotal_P = trim($subtotal_P);
         //убиарем лишние пробелы
         $subtotal_P = str_replace(',', '.', $subtotal_P);
         // заменяем запятые на точку
         $subtotal_P = floatval($subtotal_P);
         // пробуем преобразовать к числу
         $subtotal_P = round($subtotal_P, 2);
         // округляем до 2 знаков после запятой
         if ($subtotal_P != 0 && $subtotal_P >= 10 && $subtotal_P < 10000) {
             $client_ip = $_SERVER["REMOTE_ADDR"];
             echo $client_ip . '<br \\>' . "\n";
             $order_IDP = Uniteller::NewOrder($accountId, $subtotal_P, $client_ip);
             echo $order_IDP . '<br \\>' . "\n";
             //// Для отладки разрешаем переход на страницу оплаты только с определённого IP
             //if ((strpos($client_ip, '10.79.124.') == 0)
             //    or (strpos($client_ip, '10.78.252.') == 0)) {
             Uniteller::GoToPaymentPage($accountId, $order_IDP, $subtotal_P);
             //}
         } else {
             // при некорректно введенной сумме платежа возвращаемся на эту же страницу
             $url_return = $_SERVER['HTTP_REFERER'];
             header('Location: ' . $url_return);
         }
         exit;
     }
 }
/**
 * returns the literal date 
 * Ex : if period = DB_ARCHIVES_PERIOD_WEEK and $s_date = "2006-08-14"
 * Returned string will be "Week August 14 To August 20 2006"
 * 
 * @param int period 
 * @param string s_date 
 */
function getLiteralDate($period, $s_date)
{
    switch ($period) {
        case DB_ARCHIVES_PERIOD_DAY:
            return getDateDisplay(1, new Date($s_date));
            break;
        case DB_ARCHIVES_PERIOD_WEEK:
        case DB_ARCHIVES_PERIOD_WEEK:
            $date = new Date($s_date);
            $mon = getFirstDayOfWeek($date);
            $sun = getDateFromTimestamp(mktime(0, 0, 0, $date->getMonth(), $date->getDay() - ($date->getWeekDayNumber() + 6) % 7 + 6, $date->getYear()));
            return getDateDisplay(3, new Date($mon), new Date($sun));
            break;
        case DB_ARCHIVES_PERIOD_MONTH:
            return getDateDisplay(4, new Date($s_date));
            break;
        case DB_ARCHIVES_PERIOD_YEAR:
            return getDateDisplay(11, new Date($s_date));
            break;
        default:
            trigger_error("Period unknown !", E_USER_ERROR);
            break;
    }
    return;
}
Example #11
0
							<td><?php 
    echo getDateFromTimestamp($payment->timestamp);
    ?>
</td>
							<td><?php 
    echo $payment->amount;
    ?>
</td>
							<td><a class="btn btn-primary add_payment_to_invoice" payment_id="<?php 
    echo $payment->payment_id;
    ?>
" amount="<?php 
    echo $payment->amount;
    ?>
" appointment_date="<?php 
    echo getDateFromTimestamp($payment->timestamp);
    ?>
" >Add</a></td>
						</tr>
						<?php 
}
?>
					</tbody>
				</table>
			</div><!--/box-content -->
		</div><!--/box --->
   	</div><!--/col -->
   	</div><!--/box-content -->
   	</div><!--/box -->
   	
</div><!--/row -->
 function getLastArchives($n, $boolOnlyGetPeriodNMinus = 0, $dateTextType = DATE_NORMAL, $o_site = false)
 {
     //var_dump($this->archive->date->get());
     $date = new Date($this->archive->date->get());
     //var_dump($date->get());
     if ($o_site) {
         $o_siteToUse = $o_site;
     } else {
         $o_siteToUse = $this->archive->site;
     }
     $toArchive = array();
     switch ($this->archive->periodType) {
         case DB_ARCHIVES_PERIOD_DAY:
             $ts = $date->getTimestamp() + 86400;
             while (sizeof($toArchive) < $n) {
                 $toArchive[] = getDateFromTimestamp($ts -= 86400);
             }
             $typeDateDisplay = 2;
             $typeDateDisplayGraph = 8;
             $typeDateDisplayGraphLongAxis = 13;
             // only take N - x, only for page views comparisons
             if ($boolOnlyGetPeriodNMinus === 1) {
                 $date0 = $toArchive[0];
                 $date1 = $toArchive[7];
                 $date2 = $toArchive[14];
                 unset($toArchive);
                 $toArchive[] = $date0;
                 $toArchive[] = $date1;
                 $toArchive[] = $date2;
                 $typeDateDisplay = 7;
                 //print("date1 $date1 date2 $date2 ");
             }
             break;
         case DB_ARCHIVES_PERIOD_WEEK:
             $ts = $date->getTimestamp();
             $ts += 86400 * 7;
             while (sizeof($toArchive) < $n) {
                 $toArchive[] = getDateFromTimestamp($ts -= 86400 * 7);
             }
             $typeDateDisplay = 6;
             $typeDateDisplayGraph = 6;
             $typeDateDisplayGraphLongAxis = 13;
             break;
         case DB_ARCHIVES_PERIOD_MONTH:
             $s_date1 = getDateFromTimestamp(mktime(23, 59, 59, $date->getMonth() - $n % 12, 15, $date->getYear() - floor($n / 12)));
             $s_date2 = $date->get();
             $toArchive = array_reverse(getDayOfMonthBetween($s_date1, $s_date2));
             $typeDateDisplay = 5;
             $typeDateDisplayGraph = 10;
             $typeDateDisplayGraphLongAxis = 10;
             break;
         case DB_ARCHIVES_PERIOD_YEAR:
             for ($i = 0; $i < $n; $i++) {
                 $a = $date->getYear() - $i;
                 $toArchive[] = $a . "-01-01";
             }
             $typeDateDisplay = 11;
             $typeDateDisplayGraph = 12;
             break;
     }
     //var_dump($this->archive->date->get());
     $return = array();
     foreach ($toArchive as $dateToArchive) {
         //print("boucle :");
         // if day, and IF current date asked is today, then take current archive
         if ($dateToArchive == $this->archive->date->get() && $this->archive->periodType === DB_ARCHIVES_PERIOD_DAY && $o_siteToUse->getId() === $this->archive->site->getId()) {
             $a = $this->archive;
             // erreur possible ici ?
         } else {
             $a = $this->getArchive($o_siteToUse, $dateToArchive, $this->archive->periodType);
         }
         if ($dateTextType == DATE_GRAPH) {
             $dateToDisplay = getDateDisplay($typeDateDisplayGraph, new Date($dateToArchive));
             $dateComputed = getDateDisplay($typeDateDisplayGraph, $a->date);
         } else {
             if ($dateTextType == DATE_NORMAL) {
                 $dateToDisplay = getDateDisplay($typeDateDisplay, new Date($dateToArchive));
                 $dateComputed = getDateDisplay($typeDateDisplay, $a->date);
             } else {
                 if ($dateTextType == DATE_GRAPH_LONG_AXIS) {
                     $dateToDisplay = getDateDisplay($typeDateDisplayGraphLongAxis, new Date($dateToArchive));
                     $dateComputed = getDateDisplay($typeDateDisplayGraphLongAxis, $a->date);
                 }
             }
         }
         if ($this->archive->periodType === DB_ARCHIVES_PERIOD_WEEK) {
             $firstDayOfWeek = new Date(getFirstDayOfWeek(new Date($dateToArchive)));
             $minDay = $o_siteToUse->getMinDay();
             if ($firstDayOfWeek->getTimestamp() >= $minDay->getTimestamp()) {
                 $dateToDisplay = getDateDisplay($typeDateDisplay, $firstDayOfWeek);
             }
         }
         if ($dateComputed == $dateToDisplay) {
             //				print("$dateToDisplay is correctly computed ($dateComputed)<br>");
             $return[$dateComputed] = $a;
         } else {
             //				print("$dateToDisplay is not correctly computed ($dateComputed) ==> empty archive<br>");
             $return[$dateToDisplay] = $this->getEmptyArchive($o_siteToUse, $dateToArchive, $this->archive->periodType);
         }
     }
     //print("\n\n");exit;
     return $return;
 }
 function deleteOldRecords()
 {
     parent::deleteOldRecords();
     if ($this->date->get() != getDateFromTimestamp(time())) {
         if (version_compare(getMysqlVersion(), '4.0') != -1) {
             $r = query("DELETE \n\t\t\t\t\t\t\tFROM " . T_LINK_VP . ", " . T_LINK_VPV . "\n\t\t\t\t\t\t\tUSING " . T_VISIT . "\n\t\t\t\t\t\t\t\tLEFT JOIN " . T_LINK_VP . "\n\t\t\t\t\t\t\t\tUSING ( idvisit )\n\t\t\t\t\t\t\t\tLEFT JOIN " . T_LINK_VPV . "\n\t\t\t\t\t\t\t\tUSING ( idlink_vp )\n\t\t\t\t\t\t\tWHERE " . T_VISIT . ".server_date = '" . $this->date->get() . "'\n\t\t\t\t\t\t \t\tAND " . T_VISIT . ".idsite = " . $this->site->getId() . "\n\t\t\t\t\t\t ");
         } else {
             // delete link_vp records
             print "Your mysql version is less than 4.0, so this process will be very long \n\t\t\t\t(a big feature is not implemented in your 3.23 version). \n\t\t\t\t<br>You should use mysql 4.0 or mysql 4.1!<br>\n\t\t\t\t<br>Vous devriez utiliser mysql 4.0 ou supérieure pour plus de performances \n\t\t\t\t(une fonctionnalité très importante est manquante à votre version 3.23<br>";
             // select all link_vp id
             $r = query("SELECT idlink_vp\n\t\t\t\t\t\t\tFROM " . T_VISIT . "\n\t\t\t\t\t\t\t\tLEFT JOIN " . T_LINK_VP . "\n\t\t\t\t\t\t\t\tUSING ( idvisit )\n\t\t\t\t\t\t\tWHERE " . T_VISIT . ".server_date = '" . $this->date->get() . "'\n\t\t\t\t\t\t \t\tAND " . T_VISIT . ".idsite = " . $this->site->getId() . "\n\t\t\t\t\t\t \t\t");
             while ($l = mysql_fetch_row($r)) {
                 if (!empty($l[0])) {
                     $r2 = query("DELETE FROM " . T_LINK_VP . "\n\t\t\t\t\t\t\t\tWHERE idlink_vp = " . $l[0]);
                 }
             }
         }
         $r3 = query("OPTIMIZE TABLE " . T_LINK_VP . ", " . T_LINK_VPV);
     }
 }