function buildSend() { $code .= '<div >'; if (isset($_GET['submit'])) { $this->db->log($_POST); //validate form $errorMessage = ''; if (sizeof($_POST['ids']) < 1) { $errorMessage = 'Please specify someone to send the ' . CARDS_NAME . ' to!'; } else { if ($_POST['pickCard'] == '' or $_POST['pickCard'] == 0) { $errorMessage = ' You must select a ' . CARDS_NAME . '!'; } } if ($errorMessage != '') { $msgType = 'error'; $title = 'There was a problem...'; $message = $errorMessage; } else { $postMsg = $_POST['msg']; if ($postMsg == $defaultMsg) { $postMsg = ''; } // reset default msg to blank $checkDuplicate = $this->cardsObj->checkResubmit($this->session->userid, $_POST['pickCard'], $_POST['ids']); if (!$checkDuplicate) { // look up card name $q = $this->db->query("SELECT name FROM Cards WHERE id={$_POST['pickCard']};"); $ci = $this->db->readQ($q); require_once PATH_CORE . '/classes/log.class.php'; $logObj = new log($this->db); foreach ($_POST['ids'] as $id) { // record sendCard in log table $logItem = $logObj->serialize(0, $this->session->userid, 'sendCard', $_POST['pickCard'], $id); $inLog = $logObj->update($logItem); $lastId = $logObj->db->getId(); if (is_numeric($lastId)) { // add postMsg to logExtra $xTable = new LogExtraTable($this->db); $le = $xTable->getRowObject(); $le->logid = $lastId; $le->txt = $postMsg; $le->insert(); } $noteMsg = ' sent you a <a href="' . URL_CANVAS . '?p=cards&o=display&id=' . $lastId . '&sid=' . $this->session->userid . '">' . $ci->name . ' ' . CARDS_NAME . '</a> via <a href="' . URL_CANVAS . '">' . SITE_TITLE . '</a>'; $apiResult = $this->page->app->facebook->api_client->notifications_send($id, $noteMsg, 'user_to_user'); } $message = ''; // success - display msg in $code directly $code .= $this->cardsObj->makeFancyTitle(CARDS_NAME . ' SENT SUCCESSFULLY', '500px'); $rxList = $this->templateObj->buildFacebookUserList('', $_POST['ids']); $code .= $this->cardsObj->makeOneCard($_POST['pickCard'], $postMsg, $rxList); $code .= '<h2><a href="?p=cards&o=send" requirelogin="******">Click here to send another ' . CARDS_NAME . '</h2></a>'; $code .= '<br><h2><a href="?p=cards&o=tx">Click here to see all the ' . CARDS_NAME . 's you have sent.</h2></a>'; $code .= '</div>'; return $code; } else { $msgType = 'error'; $title = 'There was a problem...'; $message = "<b>You have already sent that " . CARDS_NAME . " to one or more of these people.</b>"; } } } if ($message != '') { $code .= $this->page->buildMessage($msgType, $title, $message); } // prefill is user to send to if (isset($_GET['prefillId'])) { $prefillId = $_GET['prefillId']; } else { $prefillId = 0; } $code .= $this->cardsObj->buildSendForm($prefillId); $code .= '</div>'; return $code; }
if ($manageObj->modifyLibrary(PATH_CORE . '/classes/', 'content.class.php')) { require_once PATH_CORE . '/classes/content.class.php'; ContentTable::createTable($manageObj); } if ($manageObj->modifyLibrary(PATH_CORE . '/classes/', 'comments.class.php')) { require_once PATH_CORE . '/classes/comments.class.php'; CommentTable::createTable($manageObj); } if ($manageObj->modifyLibrary(PATH_CORE . '/classes/', 'cron.class.php')) { require_once PATH_CORE . '/classes/cron.class.php'; CronJobsTable::createTable($manageObj); } if ($manageObj->modifyLibrary(PATH_CORE . '/classes/', 'log.class.php')) { require_once PATH_CORE . '/classes/log.class.php'; LogTable::createTable($manageObj); LogExtraTable::createTable($manageObj); } // Resources for Folders and Links $manageObj->addTable("Folders", "id", "INT(11) unsigned NOT NULL auto_increment", "MyISAM"); $manageObj->addColumn("Folders", "folderid", "INT(11) NOT NULL default 0"); $manageObj->addColumn("Folders", "uid", "INT(11) NOT NULL default 0"); $manageObj->addColumn("Folders", "title", "VARCHAR(50) default ''"); $manageObj->addTable("FolderLinks", "id", "INT(11) unsigned NOT NULL auto_increment", "MyISAM"); $manageObj->addColumn("FolderLinks", "linkid", "INT(11) NOT NULL default 0"); $manageObj->addColumn("FolderLinks", "folderid", "INT(11) NOT NULL default 0"); $manageObj->addColumn("FolderLinks", "title", "VARCHAR(255) default ''"); $manageObj->addColumn("FolderLinks", "url", "varchar(255) default ''"); $manageObj->addColumn("FolderLinks", "notes", "VARCHAR(255) default ''"); $manageObj->addColumn('FolderLinks', 'linkType', "enum ('link','product')"); $manageObj->addColumn('FolderLinks', 'imageUrl', "VARCHAR(255) default '';"); // database updates for alpha v.11