'No tags specified, you have to specify at least one tag'); /* pass values to the template */ $tpl->assignRef('values', $_POST); /* form values */ $tpl->assign('validCode', $validCode); /* detected errors */ $tpl->assign('validText', $validText); /* error strings */ /* process form only if there's no error */ if (check_error($validCode)) { $auth = AuthLogin::instance(); $uid = $auth->getAuthData('id'); $punch = new DB_DataObject_punch(); $count = $punch->get($_POST['id']); $punch->id = $_POST['id']; $punch->uid = $uid; $punch->start = $_POST['start']; $punch->end = $_POST['end']; /* save the results */ /* XXX: this should do error checking somehow */ if ($count) { $punch->update(); } else { $punch->insert(); } $_POST['id'] = $punch->id; $tpl->assignRef('values', $_POST); /* tag the punch */ if (isset($_POST['tags']) && trim($_POST['tags']) != "") { $freetag->tag_object($uid, $punch->id, $_POST['tags']); } } }