} // --------------------------------------------------------------------------- // Secondary error checking // --------------------------------------------------------------------------- $log = new suxLog(); $photo = new suxPhoto(); $text = suxFunct::gtext('photos'); // Verify if user is allowed to edit this photo. if (!$photo->isPhotoOwner($_POST['id'], $_SESSION['users_id'])) { exit; } $clean = array('id' => $_POST['id'], 'description' => $_POST['description']); try { $photo->savePhoto($_SESSION['users_id'], $clean); $tmp = $photo->getPhotoByID($clean['id']); if ($tmp['description']) { echo $tmp['description']; } else { echo $text['clickme']; } $log->write($_SESSION['users_id'], "sux0r::photos::describe() photos_id: {$clean['id']}", 1); // Private } catch (Exception $e) { echo $e->getMessage(); } // --------------------------------------------------------------------------- // Clear template caches // --------------------------------------------------------------------------- $tpl = new suxTemplate('photos'); $tpl->clearCache(null, $_SESSION['nickname']); // clear all user caches
/** * Process the form * * @param array $clean reference to validated $_POST */ function formProcess(&$clean) { if (!isset($_FILES['image']) || !is_uploaded_file($_FILES['image']['tmp_name'])) { throw new Exception('No file uploaded?'); } // Check that the user is allowed to upload photos / Security check #2 if (!$this->user->isRoot()) { $access = $this->user->getAccess($this->module); if ($access < $GLOBALS['CONFIG']['ACCESS'][$this->module]['admin']) { if ($access < $GLOBALS['CONFIG']['ACCESS'][$this->module]['publisher']) { suxFunct::redirect(suxFunct::makeURL('/photos')); } elseif (!$this->photo->isAlbumOwner($clean['album'], $_SESSION['users_id'])) { suxFunct::redirect(suxFunct::makeURL('/photos')); } } } // Commence collecting $photo array $photo['photoalbums_id'] = $clean['album']; // Get extension $format = explode('.', $_FILES['image']['name']); $format = strtolower(end($format)); // Set the data dir $data_dir = suxFunct::dataDir($this->module); if ($format != 'zip') { // ---------------------------------------------------------------- // Image file // ---------------------------------------------------------------- list($resize, $fullsize) = suxPhoto::renameImage($_FILES['image']['name']); $photo['image'] = $resize; // Add image to $photo array $resize = $data_dir . "/{$resize}"; $fullsize = $data_dir . "/{$fullsize}"; $md5 = md5_file($_FILES['image']['tmp_name']); if (!$this->photo->isDupe($md5, $_SESSION['users_id'], $photo['photoalbums_id'])) { suxPhoto::resizeImage($format, $_FILES['image']['tmp_name'], $resize, $this->tpl->getConfigVars('thumbnailWidth'), $this->tpl->getConfigVars('thumbnailHeight')); move_uploaded_file($_FILES['image']['tmp_name'], $fullsize); // Insert $photo into database $photo['md5'] = $md5; $this->photo->savePhoto($_SESSION['users_id'], $photo); } } else { // ---------------------------------------------------------------- // Zip file // ---------------------------------------------------------------- $tmp_dir = $GLOBALS['CONFIG']['PATH'] . '/temporary/' . md5(uniqid(mt_rand(), true)); if (!is_dir($tmp_dir) && !mkdir($tmp_dir, 0777, true)) { throw new Exception('Can\'t create temp dir ' . $tmp_dir); } if (suxFunct::unzip($_FILES['image']['tmp_name'], $tmp_dir)) { $valid_formats = array('jpg', 'jpeg', 'png', 'gif'); $files = array(); foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($tmp_dir)) as $file) { if (!$file->isFile()) { continue; } if (mb_strpos($file->getPathname(), '__MACOSX') !== false) { continue; } $files[$file->getPathname()] = $file->getFilename(); } foreach ($files as $filepath => $file) { $format = explode('.', $file); $format = strtolower(end($format)); if (!in_array($format, $valid_formats)) { continue; } // Skip list($resize, $fullsize) = suxPhoto::renameImage($file); $photo['image'] = $resize; // Add image to $photo array $resize = $data_dir . "/{$resize}"; $fullsize = $data_dir . "/{$fullsize}"; $md5 = md5_file($filepath); if (!$this->photo->isDupe($md5, $_SESSION['users_id'], $photo['photoalbums_id'])) { suxPhoto::resizeImage($format, $filepath, $resize, $this->tpl->getConfigVars('thumbnailWidth'), $this->tpl->getConfigVars('thumbnailHeight')); copy($filepath, $fullsize); // Insert $photo into database $photo['md5'] = $md5; $this->photo->savePhoto($_SESSION['users_id'], $photo); } } } suxFunct::obliterateDir($tmp_dir); } $this->log->write($_SESSION['users_id'], "sux0r::photosUpload() photoalbums_id: {$photo['photoalbums_id']}", 1); // Private $this->photo->setPublished(true); $tmp = $this->photo->getAlbumByID($photo['photoalbums_id']); // Is actually published? $this->photo->setPublished(null); // Revert if ($tmp) { // Clear all caches, cheap and easy $this->tpl->clearAllCache(); // Log message $log = ''; $url = suxFunct::makeUrl("/user/profile/{$_SESSION['nickname']}", null, true); $log .= "<a href='{$url}'>{$_SESSION['nickname']}</a> "; $log .= mb_strtolower($this->r->gtext['uploaded_images']); $url = suxFunct::makeUrl("/photos/album/{$tmp['id']}", null, true); $log .= " <a href='{$url}'>{$tmp['title']}</a>"; // Log $this->log->write($_SESSION['users_id'], $log); // Clear caches, cheap and easy $tpl = new suxTemplate('user'); $tpl->clearCache(null, $_SESSION['nickname']); } }
/** * Process the form * * @param array $clean reference to validated $_POST */ function formProcess(&$clean) { // -------------------------------------------------------------------- // Clear user caches // -------------------------------------------------------------------- foreach ($this->caches as $module) { // clear all caches with "nickname" as the first cache_id group $tpl = new suxTemplate($module); $tpl->clearCache(null, "{$_SESSION['nickname']}"); } // -------------------------------------------------------------------- // Action // -------------------------------------------------------------------- switch ($clean['action']) { case 'addvec': $this->nb->addVectorWithUser($clean['vector'], $_SESSION['users_id']); unset($clean['vector']); $this->log->write($_SESSION['users_id'], "sux0r::bayesEdit() addvec", 1); // Private break; case 'remvec': // Security check if ($this->nb->isVectorOwner($clean['vector_id'], $_SESSION['users_id'])) { // Remove vector $this->nb->removeVector($clean['vector_id']); $this->log->write($_SESSION['users_id'], "sux0r::bayesEdit() remvec id: {$clean['vector_id']}", 1); // Private } unset($clean['vector_id']); break; case 'addcat': // Security check if ($this->nb->isVectorOwner($clean['vector_id'], $_SESSION['users_id'])) { $this->nb->addCategory($clean['category'], $clean['vector_id']); $this->log->write($_SESSION['users_id'], "sux0r::bayesEdit() addcat", 1); // Private } unset($clean['category']); break; case 'remcat': // Security check if ($this->nb->isCategoryOwner($clean['category_id'], $_SESSION['users_id'])) { // Remove category $this->nb->removeCategory($clean['category_id']); $this->log->write($_SESSION['users_id'], "sux0r::bayesEdit() remcat id: {$clean['category_id']}", 1); // Private } unset($clean['category_id']); break; case 'adddoc': // Security check if ($this->nb->isCategoryTrainer($clean['category_id'], $_SESSION['users_id'])) { $this->nb->trainDocument($clean['document'], $clean['category_id']); $this->log->write($_SESSION['users_id'], "sux0r::bayesEdit() adddoc", 1); // Private } unset($clean['document']); break; case 'remdoc': // Security check if ($this->nb->isDocumentOwner($clean['document_id'], $_SESSION['users_id'])) { // Remove document $this->nb->untrainDocument($clean['document_id']); $this->log->write($_SESSION['users_id'], "sux0r::bayesEdit() remdoc id: {$clean['document_id']}", 1); // Private } unset($clean['document_id']); break; case 'sharevec': // Security check if ($this->nb->isVectorOwner($clean['vector_id'], $_SESSION['users_id'])) { $clean['trainer'] = isset($clean['trainer']) && $clean['trainer'] ? true : false; $clean['owner'] = isset($clean['owner']) && $clean['owner'] ? true : false; $this->nb->shareVector($clean['users_id'], $clean['vector_id'], $clean['trainer'], $clean['owner']); $u = $this->user->getByID($clean['users_id']); // clear caches foreach ($this->caches as $module) { $tpl = new suxTemplate($module); $tpl->clearCache(null, $_SESSION['nickname']); $tpl->clearCache(null, $u['nickname']); } // Log message $log = ''; $url = suxFunct::makeUrl("/user/profile/{$_SESSION['nickname']}", null, true); $log .= "<a href='{$url}'>{$_SESSION['nickname']}</a> "; $log .= mb_strtolower($this->r->gtext['share_category']); $url = suxFunct::makeUrl("/user/profile/{$u['nickname']}", null, true); $log .= " <a href='{$url}'>{$u['nickname']}</a>"; // Log $this->log->write($_SESSION['users_id'], $log); $this->log->write($u['users_id'], $log); // Clear caches $tpl = new suxTemplate('user'); $tpl->clearCache(null, $_SESSION['nickname']); $tpl->clearCache(null, $u['nickname']); } break; case 'unsharevec': foreach ($clean['unshare'] as $val) { foreach ($val as $vectors_id => $users_id) { $this->nb->unshareVector($users_id, $vectors_id); $u = $this->user->getByID($users_id); // Clear caches foreach ($this->caches as $module) { $tpl = new suxTemplate($module); $tpl->clearCache(null, $_SESSION['nickname']); $tpl->clearCache(null, $u['nickname']); } // Log message $log = ''; $url = suxFunct::makeUrl("/user/profile/{$_SESSION['nickname']}", null, true); $log .= "<a href='{$url}'>{$_SESSION['nickname']}</a> "; $log .= mb_strtolower($this->r->gtext['unshare_category']); $url = suxFunct::makeUrl("/user/profile/{$u['nickname']}", null, true); $log .= " <a href='{$url}'>{$u['nickname']}</a>"; // Log $this->log->write($_SESSION['users_id'], $log); $this->log->write($u['users_id'], $log); // Clear caches $tpl = new suxTemplate('user'); $tpl->clearCache(null, $_SESSION['nickname']); $tpl->clearCache(null, $u['nickname']); } } break; } }
// Ajax // Lament to the log require_once dirname(__FILE__) . '/../../config.php'; require_once dirname(__FILE__) . '/../../initialize.php'; // --------------------------------------------------------------------------- // Error checking // --------------------------------------------------------------------------- if (!isset($_SESSION['users_id'])) { die; } if (empty($_POST['lament'])) { die; } $lament = strip_tags($_POST['lament']); $lament = trim($lament); $lament = substr($lament, 0, 500); if (!$lament) { die; } // --------------------------------------------------------------------------- // Go // --------------------------------------------------------------------------- $log = new suxLog(); $log->write($_SESSION['users_id'], $lament); // --------------------------------------------------------------------------- // Clear template caches // --------------------------------------------------------------------------- $tpl = new suxTemplate('user'); $tpl->clearCache('profile.tpl', "{$_SESSION['nickname']}|{$_SESSION['nickname']}"); echo $lament;
/** * Process the form * * @param array $clean reference to validated $_POST */ function formProcess(&$clean) { // -------------------------------------------------------------------- // Sanity check // -------------------------------------------------------------------- // Date $clean['published_on'] = "{$clean['Date']} {$clean['Time_Hour']}:{$clean['Time_Minute']}:{$clean['Time_Second']}"; $clean['published_on'] = date('Y-m-d H:i:s', strtotime($clean['published_on'])); // Sanitize // Unset image? if (!empty($clean['unset_image'])) { $clean['image'] = ''; } // Set to empty string // Image? if (isset($_FILES['image']) && is_uploaded_file($_FILES['image']['tmp_name'])) { $format = explode('.', $_FILES['image']['name']); $format = strtolower(end($format)); // Extension list($resize, $fullsize) = suxPhoto::renameImage($_FILES['image']['name']); $clean['image'] = $resize; // Add image to clean array $resize = suxFunct::dataDir($this->module) . "/{$resize}"; $fullsize = suxFunct::dataDir($this->module) . "/{$fullsize}"; suxPhoto::resizeImage($format, $_FILES['image']['tmp_name'], $resize, $this->tpl->getConfigVars('thumbnailWidth'), $this->tpl->getConfigVars('thumbnailHeight')); move_uploaded_file($_FILES['image']['tmp_name'], $fullsize); } // Draft $clean['draft'] = isset($clean['draft']) && $clean['draft'] ? true : false; // -------------------------------------------------------------------- // Create $msg array // -------------------------------------------------------------------- $msg = array('title' => $clean['title'], 'image' => @$clean['image'], 'body' => $clean['body'], 'published_on' => $clean['published_on'], 'draft' => $clean['draft'], 'blog' => true); if (isset($clean['id'])) { $msg['id'] = $clean['id']; } // -------------------------------------------------------------------- // Put $msg in database // -------------------------------------------------------------------- // New $clean['id'] = $this->msg->save($_SESSION['users_id'], $msg, true); $this->msg->setPublished(true); $tmp = $this->msg->getByID($clean['id']); // Is actually published? $this->msg->setPublished(null); // Revert if ($tmp) { // Clear all caches, cheap and easy $this->tpl->clearAllCache(); // Log message $log = ''; $url = suxFunct::makeUrl("/user/profile/{$_SESSION['nickname']}", null, true); $log .= "<a href='{$url}'>{$_SESSION['nickname']}</a> "; $log .= mb_strtolower($this->r->gtext['posted_blog']); $url = suxFunct::makeUrl("/blog/view/{$tmp['thread_id']}", null, true); $log .= " <a href='{$url}'>{$tmp['title']}</a>"; // Log $this->log->write($_SESSION['users_id'], $log); // Clear cache $tpl = new suxTemplate('user'); $tpl->clearCache('profile.tpl', $_SESSION['nickname']); } $this->log->write($_SESSION['users_id'], "sux0r::blogEdit() messages_id: {$clean['id']}", 1); // Private // -------------------------------------------------------------------- // Tags procedure // -------------------------------------------------------------------- // Parse tags $tags = @suxTags::parse($clean['tags']); // Save tags into database $tag_ids = array(); foreach ($tags as $tag) { $tag_ids[] = $this->tags->save($_SESSION['users_id'], $tag); } //Delete current links $this->link->deleteLink('link__messages__tags', 'messages', $clean['id']); // Reconnect links foreach ($tag_ids as $id) { $this->link->saveLink('link__messages__tags', 'messages', $clean['id'], 'tags', $id); } // -------------------------------------------------------------------- // Naive Bayesian procedure // -------------------------------------------------------------------- /* `link__bayes_documents__messages` asserts that a message was trained and copied into a bayes document, it does not imply that it's the same document When a user edits their own document we can assume that we want the updated document to represent their selected categories However, we cannot assume this for the catgories of others. Example: I write and classify a 5000 word message. Several other users find my post and classify it too. Time passes, I'm drunk, I reduce the post to "Eat shit." Course of action: Deleting all links to a message for which I can train the vector seems the safest bet. Other users get to keep what they already classified, and can reclassify the modified document at a later date if they wish. They can also manually adjust the eroneous documents in the bayes module. Problem / TODO: I write and classify a 5000 word blog. Someone with permission to edit my blog, but who does not share my Bayesian vectors reduces the post to "Eat shit." Author's categories are now meaningless as blog tags. Now what? */ // Get all the bayes_documents linked to this message where user is trainer // untrain it, delete links $innerjoin = "\n INNER JOIN link__bayes_documents__messages ON link__bayes_documents__messages.bayes_documents_id = bayes_documents.id\n INNER JOIN messages ON link__bayes_documents__messages.messages_id = messages.id\n INNER JOIN bayes_categories ON bayes_categories.id = bayes_documents.bayes_categories_id\n INNER JOIN bayes_auth ON bayes_categories.bayes_vectors_id = bayes_auth.bayes_vectors_id\n "; $query = "\n SELECT bayes_documents.id FROM bayes_documents\n {$innerjoin}\n WHERE messages.id = ?\n AND bayes_auth.users_id = ? AND (bayes_auth.owner = true OR bayes_auth.trainer = true)\n "; // Note: bayes_auth WHERE condition equivilant to nb->isCategoryTrainer() $db = suxDB::get(); $st = $db->prepare($query); $st->execute(array($clean['id'], $_SESSION['users_id'])); $tmp = $st->fetchAll(PDO::FETCH_ASSOC); foreach ($tmp as $val) { $this->nb->untrainDocument($val['id']); } // Regcategorize // category ids submitted by the form if (isset($clean['category_id'])) { foreach ($clean['category_id'] as $val) { if (!empty($val) && $this->nb->isCategoryTrainer($val, $_SESSION['users_id'])) { $doc_id = $this->nb->trainDocument("{$clean['title']} \n\n {$clean['body']}", $val); $this->link->saveLink('link__bayes_documents__messages', 'bayes_documents', $doc_id, 'messages', $clean['id']); } } } $this->id = $clean['id']; // Remember this id }
$tpl->configLoad('my.conf', $module); $image = $tpl->getConfigVars('imgUnsubscribed'); $db = suxDB::get(); $query = "SELECT COUNT(*) FROM {$link} WHERE {$col}_id = ? AND users_id = ? "; $st = $db->prepare($query); $st->execute(array($id, $_SESSION['users_id'])); if ($st->fetchColumn() > 0) { // Delete $query = "DELETE FROM {$link} WHERE {$col}_id = ? AND users_id = ? "; $st = $db->prepare($query); $st->execute(array($id, $_SESSION['users_id'])); } else { // Insert $suxLink = new suxLink(); $suxLink->saveLink($link, 'users', $_SESSION['users_id'], $col, $id); $image = $tpl->getConfigVars('imgSubscribed'); } // Log $log = new suxLog(); $log->write($_SESSION['users_id'], "sux0r::feeds::toggle() bookmarks_id: {$id}", 1); // Private // --------------------------------------------------------------------------- // Clear template caches // --------------------------------------------------------------------------- $tpl->clearCache(null, "{$_SESSION['nickname']}"); // clear all caches with "nickname" as the first cache_id group // --------------------------------------------------------------------------- // Return image string to Ajax request // --------------------------------------------------------------------------- echo trim($image); exit;
/** * Process the form * * @param array $clean reference to validated $_POST */ function formProcess(&$clean) { // -------------------------------------------------------------------- // Sanitize // -------------------------------------------------------------------- // Captcha unset($_SESSION['captcha']); unset($clean['captcha']); // Redundant password field unset($clean['password_verify']); // Birthday if (!empty($clean['Date_Year']) && !empty($clean['Date_Month']) && !empty($clean['Date_Day'])) { $clean['dob'] = "{$clean['Date_Year']}-{$clean['Date_Month']}-{$clean['Date_Day']}"; } if (isset($clean['dob']) && !filter_var($clean['dob'], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => "/^(\\d{1,4})-(\\d{1,2})-(\\d{1,2})\$/")))) { $clean['dob'] = null; } unset($clean['Date_Year'], $clean['Date_Month'], $clean['Date_Day']); if (isset($clean['dob'])) { $clean['dob'] = date('Y-m-d', strtotime($clean['dob'])); } else { $clean['dob'] = null; } // -------------------------------------------------------------------- // Edit Mode // -------------------------------------------------------------------- if ($this->mode == 'edit') { // Get users_id $u = $this->user->getByNickname($clean['nickname']); if (!$u) { throw new Exception('Invalid user'); } $id = $u['users_id']; } // -------------------------------------------------------------------- // Openid // -------------------------------------------------------------------- if ($this->isOpenID()) { $clean['password'] = $this->user->generatePw(); // Random password $clean['openid_url'] = $_SESSION['openid_url_registration']; // Assign } // -------------------------------------------------------------------- // SQL // -------------------------------------------------------------------- if (isset($id) && filter_var($id, FILTER_VALIDATE_INT)) { $this->user->save($id, $clean); // Log if ($id == $_SESSION['users_id']) { // Self edit $log = ''; $url = suxFunct::makeUrl("/user/profile/{$_SESSION['nickname']}", null, true); $log .= "<a href='{$url}'>{$_SESSION['nickname']}</a> "; $log .= mb_strtolower($this->r->gtext['changed_profile']); $this->log->write($_SESSION['users_id'], $log); } else { // Administrator edit $this->log->write($_SESSION['users_id'], "sux0r::userEdit() users_id: {$id}", 1); // Log, private } } else { $id = $this->user->save(null, $clean); $this->log->write($id, "sux0r::userEdit() new users_id: {$id} ", 1); // Log, private } // -------------------------------------------------------------------- // Cleanup // -------------------------------------------------------------------- unset($_SESSION['openid_url_registration'], $_SESSION['openid_url_integrity']); // Clear caches, cheap and easy $this->tpl->clearAllCache(); // Reset session if ($this->mode == 'edit' && $clean['nickname'] == $_SESSION['nickname']) { foreach ($this->caches as $module) { // clear all caches with "nickname" as the first cache_id group $tpl = new suxTemplate($module); $tpl->clearCache(null, "{$_SESSION['nickname']}"); } // Reset session $this->user->setSession($id); } }
/** * Process the form * * @param array $clean reference to validated $_POST */ function formProcess(&$clean) { $fid = $clean['users_id']; $rel = ''; $u = $this->user->getByID($clean['users_id']); $log = ''; // Don't let the user establish a relationship with themselves if ($fid == $_SESSION['users_id']) { suxFunct::redirect(suxFunct::getPreviousURL()); } // Strings if (isset($clean['friendship'])) { $rel .= $clean['friendship'] . ' '; } if (isset($clean['geographical'])) { $rel .= $clean['geographical'] . ' '; } if (isset($clean['family'])) { $rel .= $clean['family'] . ' '; } // Arrays if (isset($clean['identity'])) { foreach ($clean['identity'] as $val) { $rel .= $val . ' '; } } if (isset($clean['physical'])) { foreach ($clean['physical'] as $val) { $rel .= $val . ' '; } } if (isset($clean['professional'])) { foreach ($clean['professional'] as $val) { $rel .= $val . ' '; } } if (isset($clean['romantic'])) { foreach ($clean['romantic'] as $val) { $rel .= $val . ' '; } } // Set relationship $rel = trim($rel); if (empty($rel)) { $this->soc->deleteRelationship($_SESSION['users_id'], $fid); // Log message $url = suxFunct::makeUrl("/user/profile/{$_SESSION['nickname']}", null, true); $log .= "<a href='{$url}'>{$_SESSION['nickname']}</a> "; $log .= mb_strtolower($this->r->gtext['end_relation']); $url = suxFunct::makeUrl("/user/profile/{$u['nickname']}", null, true); $log .= " <a href='{$url}'>{$u['nickname']}</a>"; } else { $this->soc->saveRelationship($_SESSION['users_id'], $fid, $rel); // Log message $url = suxFunct::makeUrl("/user/profile/{$_SESSION['nickname']}", null, true); $log .= "<a href='{$url}'>{$_SESSION['nickname']}</a> "; $log .= mb_strtolower($this->r->gtext['change_relation']); $url = suxFunct::makeUrl("/user/profile/{$u['nickname']}", null, true); $log .= " <a href='{$url}'>{$u['nickname']}</a>"; } // Log $this->log->write($_SESSION['users_id'], $log); $this->log->write($u['users_id'], $log); // Clear caches, cheap and easy $tpl = new suxTemplate('user'); $tpl->clearCache(null, $_SESSION['nickname']); }
/** * Process the form * * @param array $clean reference to validated $_POST */ function formProcess(&$clean) { // -------------------------------------------------------------------- // Sanity check // -------------------------------------------------------------------- // Date $clean['published_on'] = "{$clean['Date']} {$clean['Time_Hour']}:{$clean['Time_Minute']}:{$clean['Time_Second']}"; $clean['published_on'] = date('Y-m-d H:i:s', strtotime($clean['published_on'])); // Sanitize // Draft $clean['draft'] = isset($clean['draft']) && $clean['draft'] ? true : false; // -------------------------------------------------------------------- // Create $album array // -------------------------------------------------------------------- $album = array('title' => $clean['title'], 'body' => $clean['body'], 'published_on' => $clean['published_on'], 'draft' => $clean['draft']); if (isset($clean['id'])) { $album['id'] = $clean['id']; } // -------------------------------------------------------------------- // Put $album in database // -------------------------------------------------------------------- $id = $this->photo->saveAlbum($_SESSION['users_id'], $album); $this->log->write($_SESSION['users_id'], "sux0r::photoalbumsEdit() photoalbums_id: {$id}", 1); // Private $this->photo->setPublished(true); $tmp = $this->photo->getAlbumByID($id); // Is actually published? $this->photo->setPublished(null); // Revert if ($tmp) { // Clear all caches, cheap and easy $this->tpl->clearAllCache(); if (!isset($clean['id'])) { // New album log message $log = ''; $url = suxFunct::makeUrl("/user/profile/{$_SESSION['nickname']}", null, true); $log .= "<a href='{$url}'>{$_SESSION['nickname']}</a> "; $log .= mb_strtolower($this->r->gtext['created_album']); $url = suxFunct::makeUrl("/photos/album/{$tmp['id']}", null, true); $log .= " <a href='{$url}'>{$tmp['title']}</a>"; $this->log->write($_SESSION['users_id'], $log); } // Clear caches, cheap and easy $tpl = new suxTemplate('user'); $tpl->clearCache(null, $_SESSION['nickname']); } }
/** * Process the form * * @param array $clean reference to validated $_POST */ function formProcess(&$clean) { $msg['blog'] = true; $msg['title'] = $clean['title']; $msg['body'] = $clean['body']; $msg['parent_id'] = $clean['parent_id']; $id = $this->msg->save($_SESSION['users_id'], $msg); $this->log->write($_SESSION['users_id'], "sux0r::blogReply() messages_id: {$id}", 1); // Private $tmp = $this->msg->getByID($clean['parent_id']); // Is actually published? if ($tmp) { // Clear caches $this->tpl->clearCache(null, $_SESSION['nickname']); // Log message $log = ''; $url = suxFunct::makeUrl("/user/profile/{$_SESSION['nickname']}", null, true); $log .= "<a href='{$url}'>{$_SESSION['nickname']}</a> "; $log .= mb_strtolower($this->r->gtext['replied_blog']); $url = suxFunct::makeUrl("/blog/view/{$tmp['thread_id']}", null, true); $log .= " <a href='{$url}'>{$tmp['title']}</a>"; // Log $this->log->write($_SESSION['users_id'], $log); // Clear cache $tpl = new suxTemplate('user'); $tpl->clearCache('profile.tpl', $_SESSION['nickname']); } }