function deleteAction() { $id = $this->_request->getParam('id', 0); $templates = new Templates(); if ($this->_request->isPost()) { $confirm = $this->_request->getPost('confirm'); $return_to = $this->_request->getParam('return_to', 0); if (!strcmp($confirm, 'Confirm') && $id > 0) { $templates->delete('id=' . $id); // remove all the viewers using this template $viewer_class = new Viewers(); $viewer_class->delete('template_id' . $id); } elseif (!strcmp($return_to, 'view')) { $this->_redirect('/template/view/id/' . $id); return; } $this->_redirect('/template/list'); } elseif ($id > 0) { $this->view->title = 'Confirm Deletion'; $templates = new Templates(); $template = $templates->fetchRow('id=' . $id); $this->view->template_name = $template->name; $form = new TemplateDeleteForm(); $in_return_to = $this->_request->getParam('return_to', 0); if ($in_return_to) { $return_to = new PP_Form_Element_Hidden('return_to'); $return_to->setValue($in_return_to); $form->addElement($return_to); } $form->confirm->setLabel('Confirm'); $form->cancel->setLabel('Cancel'); $this->view->form = $form; } }
$url_description = $GPXIN['description']; echo $Templates->create($url_netid, $url_gameid, $url_file_path, $url_description, $url_default); } elseif ($url_do == 'save') { // Get this game ID $result_gid = @mysql_query("SELECT cfgid FROM templates WHERE id = '{$url_id}'"); $row_gid = mysql_fetch_row($result_gid); $this_gameid = $row_gid[0]; // If default, make all others not default if ($url_default) { @mysql_query("UPDATE templates SET is_default = '0' WHERE cfgid = '{$this_gameid}' AND netid = '{$url_netid}'") or die('Failed to update template settings (1)'); } // Update values @mysql_query("UPDATE templates SET is_default = '{$url_default}',description = '{$url_descr}' WHERE id = '{$url_id}'") or die('Failed to update template settings (2)'); echo 'success'; } elseif ($url_do == 'delete') { echo $Templates->delete($url_id); } elseif ($url_do == 'checkdone') { require DOCROOT . '/includes/classes/network.php'; $Network = new Network(); // Get list of unfinished templates $result_unf = @mysql_query("SELECT id,netid,steam_percent,status FROM templates WHERE status = 'running' OR status = 'steam_running' ORDER BY id ASC"); $total_rows = mysql_num_rows($result_unf); if ($total_rows > 1) { $total_rows = $total_rows - 1; } // Change for array counting $cntr = 1; $netids = array(); $orig_netid = ''; $tpl_list = ''; if ($total_rows) {