예제 #1
0
파일: controller.php 프로젝트: xi67/MAB-LAB
         if (array_key_exists('currency-update-db', $_POST) == 1) {
             $currency = new Currency($mCfg->getCurrencyCode());
             DbHelper::updateSalesCurrency($currency);
         }
         Helper::pushAlert(ALERT_SUCCESS, 'Configuration saved.');
     } else {
         Helper::pushAlert(ALERT_ERROR, $error);
     }
     header('Location:index.php?p=' . PAGE_ID_CONFIG);
     break;
     //////// DEL USER
 //////// DEL USER
 case 'deluser':
     $userId = @$_POST['userId'];
     if (!empty($userId)) {
         if (DBHelper::countRows(TBL_USERS) > 1) {
             if (DBHelper::deleteUsers($userId)) {
                 Helper::pushAlert(ALERT_SUCCESS, 'User deleted with success !');
             } else {
                 Helper::pushAlert(ALERT_ERROR, 'Unable to delete user with id #' . $userId);
             }
         } else {
             Helper::pushAlert(ALERT_ERROR, 'You must keep at least one user !!!');
         }
     } else {
         Helper::pushAlert(ALERT_ERROR, 'User id is not valid !');
     }
     header('Location:index.php?p=' . PAGE_ID_USERS);
     break;
     //////// EDIT USER
 //////// EDIT USER
예제 #2
0
파일: update.php 프로젝트: xi67/MAB-LAB
            echo '<i style="padding-left:30px;" >|_ Update reports in (' . implode(', ', $issue['reports']) . ') with issue id ' . $issueId . ' ... </i>';
            if (DBHelper::updateReportsIssue($issue['reports'], $issueId)) {
                echo '<i>OK</i><br/>';
            } else {
                echo '<i style="color:red" >FAILED</i><br/>';
            }
        } else {
            echo '<i style="color:red" >FAILED</i><br/>';
            echo '<i style="padding-left:30px; color:red; font-weight:bold;" >' . DBHelper::getLastError() . '</i><br/>';
        }
    }
} catch (Exception $e) {
    echo '<b style="padding-left:30px; color:red;" >' . $e->getMessage() . '</b><br/>';
    exit;
}
echo '<b>Step 5.</b> ... OK<br/>';
echo '<b>Step 6.</b> Create database triggers ... ';
$res = DBHelper::exec($sql[1], true);
if ($res != null) {
    echo '<br/><b style="padding-left:30px; color:red;" >' . $res . '</b>';
    exit;
}
DBHelper::clearStoredResults();
// count triggers
$res = DBHelper::countRows('information_schema.triggers', null, true);
if ($res != 4) {
    echo '<b style="color:red" >FAILED</b><br/><b style="padding-left:30px; color:red;" >All triggers not created properly !</b>';
} else {
    echo 'OK<br/>';
}
echo '<p><b style="color:green" >UPDATE IS COMPLETE !</b></p>';