function checksettings()
{
    global $connect, $dbprefix, $clang, $databasename, $scriptname, $iFileUploadTotalSpaceMB;
    //GET NUMBER OF SURVEYS
    $query = "SELECT count(sid) FROM ".db_table_name('surveys');
    $surveycount=$connect->GetOne($query);   //Checked
    $query = "SELECT count(sid) FROM ".db_table_name('surveys')." WHERE active='Y'";
    $activesurveycount=$connect->GetOne($query);  //Checked
    $query = "SELECT count(users_name) FROM ".db_table_name('users');
    $usercount = $connect->GetOne($query);   //Checked

    if ($activesurveycount==false) $activesurveycount=0;
    if ($surveycount==false) $surveycount=0;

    $tablelist = $connect->MetaTables();
    foreach ($tablelist as $table)
    {
        if (strpos($table,$dbprefix."old_tokens_")!==false)
        {
            $oldtokenlist[]=$table;
        }
        elseif (strpos($table,$dbprefix."tokens_")!==false)
        {
            $tokenlist[]=$table;
        }
        elseif (strpos($table,$dbprefix."old_survey_")!==false)
        {
            $oldresultslist[]=$table;
        }
    }
    if(isset($oldresultslist) && is_array($oldresultslist))
    {$deactivatedsurveys=count($oldresultslist);} else {$deactivatedsurveys=0;}
    if(isset($oldtokenlist) && is_array($oldtokenlist))
    {$deactivatedtokens=count($oldtokenlist);} else {$deactivatedtokens=0;}
    if(isset($tokenlist) && is_array($tokenlist))
    {$activetokens=count($tokenlist);} else {$activetokens=0;}
    $cssummary = "<div class='header ui-widget-header'>".$clang->gT("System overview")."</div>\n";
    // Database name & default language
    $cssummary .= "<br /><table class='statisticssummary'><tr>\n"
    . "<th width='50%' align='right'>".$clang->gT("Database name").":</th><td>$databasename</td>\n"
    . "</tr>\n";
    // Other infos
    $cssummary .=  "<tr>\n"
    . "<th align='right'>".$clang->gT("Users").":</th><td>$usercount</td>\n"
    . "</tr>\n"
    . "<tr>\n"
    . "<th align='right'>".$clang->gT("Surveys").":</th><td>$surveycount</td>\n"
    . "</tr>\n"
    . "<tr>\n"
    . "<th align='right'>".$clang->gT("Active surveys").":</th><td>$activesurveycount</td>\n"
    . "</tr>\n"
    . "<tr>\n"
    . "<th align='right'>".$clang->gT("Deactivated result tables").":</th><td>$deactivatedsurveys</td>\n"
    . "</tr>\n"
    . "<tr>\n"
    . "<th align='right'>".$clang->gT("Active token tables").":</th><td>$activetokens</td>\n"
    . "</tr>\n"
    . "<tr>\n"
    . "<th align='right'>".$clang->gT("Deactivated token tables").":</th><td>$deactivatedtokens</td>\n"
    . "</tr>\n";

    if ($iFileUploadTotalSpaceMB>0)
    {
        $fUsed=fCalculateTotalFileUploadUsage();
        $cssummary .= "<tr>\n"
        . "<th align='right'>".$clang->gT("Used/free space for file uploads").":</th><td>".sprintf('%01.2F',$fUsed)." MB / ".sprintf('%01.2F',$iFileUploadTotalSpaceMB-$fUsed)." MB</td>\n"
        . "</tr>\n";
    }
    $cssummary .= "</table>\n";

    if ($_SESSION['USER_RIGHT_CONFIGURATOR'] == 1)
    {
        $cssummary .= "<p><input type='button' onclick='window.open(\"$scriptname?action=showphpinfo\")' value='".$clang->gT("Show PHPInfo")."' />";
    }
    return $cssummary;
}
Example #2
0
        echo ls_json_encode($return);
    } else {
        if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $randfileloc)) {
            $return = array("success" => true, "size" => $size, "name" => rawurlencode(basename($filename)), "ext" => $ext, "filename" => $randfilename, "msg" => $clang->gT("The file has been successfuly uploaded."));
            echo ls_json_encode($return);
            // TODO : unlink this file since this is just a preview
            // unlink($randfileloc);
        }
    }
} else {
    // if everything went fine and the file was uploaded successfuly,
    // send the file related info back to the client
    if ($size > $maxfilesize) {
        $return = array("success" => false, "msg" => sprintf($clang->gT("Sorry, this file is too large. Only files up to %s KB are allowed.", 'unescaped'), $maxfilesize));
        echo ls_json_encode($return);
    } elseif ($iFileUploadTotalSpaceMB > 0 && fCalculateTotalFileUploadUsage() + $size / 1024 / 1024 > $iFileUploadTotalSpaceMB) {
        $return = array("success" => false, "msg" => $clang->gT("We are sorry but there was a system error and your file was not saved. An email has been dispatched to notify the survey administrator.", 'unescaped'));
        echo ls_json_encode($return);
    } elseif (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $randfileloc)) {
        $return = array("success" => true, "size" => $size, "name" => rawurlencode(basename($filename)), "ext" => $ext, "filename" => $randfilename, "msg" => $clang->gT("The file has been successfuly uploaded."));
        echo ls_json_encode($return);
    } else {
        // check for upload error
        if ($_FILES['uploadfile']['error'] > 2) {
            $return = array("success" => false, "msg" => $clang->gT("Sorry, there was an error uploading your file"));
            echo ls_json_encode($return);
        } else {
            if ($_FILES['uploadfile']['error'] == 1 || $_FILES['uploadfile']['error'] == 2 || $size > $maxfilesize) {
                $return = array("success" => false, "msg" => sprintf($clang->gT("Sorry, this file is too large. Only files upto %s KB are allowed."), $maxfilesize));
                echo ls_json_encode($return);
            } else {
Example #3
0
            // TODO : unlink this file since this is just a preview
            // unlink($randfileloc);
        }
    }
    else
    {    // if everything went fine and the file was uploaded successfuly,
         // send the file related info back to the client
        if ($size > $maxfilesize)
        {
            $return = array(
                "success" => false,
                 "msg" => sprintf($clang->gT("Sorry, this file is too large. Only files up to %s KB are allowed.",'unescaped'), $maxfilesize)
            );
            echo json_encode($return);
        }
        elseif ($iFileUploadTotalSpaceMB>0 && ((fCalculateTotalFileUploadUsage()+($size/1024/1024))>$iFileUploadTotalSpaceMB))
        {
            $return = array(
                "success" => false,
                 "msg" => $clang->gT("We are sorry but there was a system error and your file was not saved. An email has been dispatched to notify the survey administrator.",'unescaped')
            );
            echo json_encode($return);
        }
        elseif (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $randfileloc))
        {
            if (!isset($_SESSION[$fieldname]['filecount']))
                $_SESSION[$fieldname]['filecount'] = 0;

            $filecount = $_SESSION[$fieldname]['filecount'] += 1;

            $_SESSION[$fieldname]['files'][$filecount]['name'] = rawurlencode(basename($filename));