Warning: session_start(): open(/var/lib/php/sessions/sess_hcpcigji1s6cu8d2fn2klg91fq, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
static synchronized S manageStringList(S s, S name, S varName, boolean canChange) {
L list = (L) get(main.class, varName);
new Matches m;
if (match("list " + plural(name), s))
ret structure(list);
if (match("how many " + plural(name), s))
ret str(l(list));
if (match("add " + name + " *", s, m)) {
if (!canChange) ret "Sorry. Not authorized";
S id = m.unq(0);
list.add(id);
save(varName);
ret "OK, " + name + " " + quote(id) + " added. List size now: " + l(list);
}
if (match("remove " + name + " *", s, m)) {
if (!canChange) ret "Sorry. Not authorized";
S id = m.unq(0);
int idx = list.indexOf(id);
if (idx < 0) ret id + " is not a " + name;
list.remove(idx);
save(varName);
ret "OK, " + name + " " + quote(id) + " removed. List size now: " + l(list);
}
ret null;
}