Beispiel #1
0
 You should have received a copy of the GNU Affero General Public License
 along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
error_reporting(E_ERROR);
require '../init.php';
$data['error'] = "error";
$data['message'] = "Unknown error";
try {
    if (!$authAdmin) {
        throw new Exception("Access denied. Please login as an Admin to continue.");
    }
    $bdd->query("TRUNCATE `t_bugs`; TRUNCATE `t_comments`;");
    $iC = new Infos('t_config');
    $iC->loadInfos('nom', 'project_name');
    $iC->setInfo('value', 'Your project');
    $iC->save('id', 'this', false, false);
    $iC->loadInfos('nom', 'git_repo');
    $iC->setInfo('value', 'git://your/git/repo/url.git');
    $iC->save('id', 'this', false, false);
    $iC->loadInfos('nom', 'project_type');
    $iC->setInfo('value', 'open-source');
    $iC->save('id', 'this', false, false);
    foreach (glob(DATA_PATH . '*') as $screen) {
        if (is_dir($screen)) {
            continue;
        }
        unlink($screen);
    }
    $data['error'] = 'OK';
    $data['message'] = $LANG['Reset_OK'];
Beispiel #2
0
 /**
  * Update a comment's text
  * @param INT $idComm Comment ID
  * @param STRING $text Comment message
  */
 public function updateComment($idComm, $text)
 {
     if (!is_int($idComm)) {
         throw new Exception("Bug::updateComment() : comment ID not a integer!");
     }
     if (strlen($text) < 3) {
         throw new Exception("Bug::updateComment() : comment text is too short!");
     }
     $iC = new Infos('t_comments');
     $iC->loadInfos('id', $idComm, false, false, false);
     $iC->setInfo('message', $text);
     $iC->save('id', 'this', false, false);
 }
Beispiel #3
0
        }
        if (strlen($newPW) < 4) {
            throw new Exception($LANG['Err_PW_too_short']);
        }
        $newPass = md5(PASSWORD_SALT . $newPW);
        $iC = new Infos('t_config');
        $iC->loadInfos('nom', 'password_access');
        $iC->setInfo('value', $newPass);
        $iC->save('id', 'this', false, false);
        $data['error'] = "OK";
        $data['message'] = $LANG['Password_change_OK'];
    }
    if ($action === 'updateLanguage') {
        if (!isset($newLang)) {
            throw new Exception("Missing language to change!");
        }
        $iC = new Infos('t_config');
        $iC->loadInfos('nom', 'language');
        $iC->setInfo('value', $newLang);
        $iC->save('id', 'this', false, false);
        $data['error'] = "OK";
        $data['message'] = $LANG['Language_change_OK'];
    }
} catch (Exception $e) {
    $data['message'] = $e->getMessage();
}
header('HTTP/1.1 200 OK');
header('Content-type: application/json; charset=UTF-8');
echo ")]}',\n";
// Pour sécu anti injection JSONP
echo json_encode($data, JSON_UNESCAPED_UNICODE);
Beispiel #4
0
        }
        $data['nextStep'] = 3;
        $data['message'] = "Database created.";
        if ($DBexists && $DBstructOk) {
            $data['message'] = "The database '" . BASE . "' already exists!";
        }
    } elseif ($step === 3) {
        if (!is_array($infos)) {
            throw new Exception("Missing SQL connection informations.");
        }
        require '../init.php';
        $iC = new Infos('t_config');
        foreach ($infos as $k => $v) {
            $iC->loadInfos('nom', $k);
            if ($k === 'password_access') {
                $iC->setInfo('value', md5(PASSWORD_SALT . $v));
            } else {
                $iC->setInfo('value', $v);
            }
            $iC->save('id', 'this', false, false);
        }
        $data['nextStep'] = 4;
        $data['message'] = "Project informations saved.";
    } else {
        throw new Exception("Unkown installation step!");
    }
} catch (Exception $e) {
    $data['error'] = $e->getMessage();
}
header('HTTP/1.1 200 OK');
header('Content-type: application/json; charset=UTF-8');