public static function createFromResponse(\SimpleXMLElement $response) { $shout = new Shout(); $shout->setAuthor((string) $response->author); $shout->setBody((string) $response->body); $shout->setDate((string) $response->date); return $shout; }
/** * Ajoute un shout * * @access public * @return redirect /shoutbox */ public function add() { $user = Auth::user(); $shout = new Shout(); $shout->content = Input::get('content'); $shout->user_id = $user->id; $v = Validator::make($shout->toArray(), $shout->rules); if ($v->passes()) { $shout->save(); } else { } return Redirect::route('shoutbox'); }
static function createComment(User $recipient, User $poster, $content) { $shout = new Shout(); $shout->setUserRelatedByPosterId($poster); $shout->setUserRelatedByRecipientId($recipient); $time = strtotime(date('Y-m-d H:i:s')) + 3120; $newTime = date('Y-m-d H:i:s', $time); $shout->setCreatedAt($newTime); $shout->setContent($content); $shout->save(); }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param Shout $value A Shout object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(Shout $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null self::$instances[$key] = $obj; } }
$notification->push(_("Extension Deleted.")); $action = 'list'; } catch (Exception $e) { $notification->push($e); } } elseif ($Form->isSubmitted()) { // Submitted but not valid $notification->push(_("Problem processing the form. Please check below and try again."), 'horde.warning'); } $vars = Horde_Variables::getDefaultVariables(array()); $vars->set('account', $curaccount); $Form = new ExtensionDeleteForm($vars); break; case 'list': default: $action = 'list'; $title .= _("List Numbers"); } try { $accounts = $shout->storage->getAccounts(); $numbers = $shout->storage->getNumbers(); } catch (Exception $e) { $notification->push($e); } $page_output->addScriptFile('stripe.js', 'horde'); $page_output->header(array('title' => $title)); require SHOUT_TEMPLATES . '/menu.inc'; $notification->notify(); Shout::getAdminTabs(); require SHOUT_TEMPLATES . '/admin/numbers/' . $action . '.inc.php'; $page_output->footer();
/** * Delete a device from the backend. * * This method is intended to be overridden by a child class. However it * also implements some basic checks, so a typical backend will still * call this method via parent:: * * @param <type> $account * @param <type> $devid */ public function deleteDevice($account, $devid) { if (empty($account) || empty($devid)) { throw new Shout_Exception(_("Invalid device.")); } if (!Shout::checkRights("shout:accounts:{$account}:devices", PERMS_DELETE, 1)) { throw new Shout_Exception(_("Permission denied to delete devices in this account.")); } }
$shout->SetId($shou_id); $shout->SetDate($date->GetDate()); $shout->SetText($shou_text); $shout->SetUser($shou_user_id); $shou_id = $shout->GetId(); $shou_date = $shout->GetConverted(); $shou_text = $shout->GetText(); $shou_user_id = $shout->GetUser(); if ($shout->Update()) { $message = $screen_module_name . " alterado com sucesso."; } else { $message = "Problemas na operação."; } } if ($action == 4) { $shout = new Shout(); $shout->SetDatabase($database); $shout->SetId($shou_id); if ($shout->Delete()) { $date = new Date(); $message = $screen_module_name . " excluído com sucesso."; $shou_id = ""; $shou_date = $date->GetNowFull(); $shou_text = ""; $shou_user_id = ""; } else { $message = "Problemas na operação."; } } } ?>
/** Get shouts for this user. * * @param string $user The username to fetch shouts for. (Required) * @return array An array of Shout objects. * * @static * @access public * @throws Error */ public static function getShouts($user) { $xml = CallerFactory::getDefaultCaller()->call('user.getShouts', array('user' => $user)); $shouts = array(); foreach ($xml->children() as $shout) { $shouts[] = Shout::fromSimpleXMLElement($shout); } return $shouts; }
function DropTables() { $moderator = new Moderator(); $moderator->SetDatabase($this); $moderator->Drop(); $message = new Message(); $message->SetDatabase($this); $message->Drop(); $topic = new Topic(); $topic->SetDatabase($this); $topic->Drop(); $user_info = new UserInfo(); $user_info->SetDatabase($this); $user_info->Drop(); $session = new Session(); $session->SetDatabase($this); $session->Drop(); $new = new News(); $new->SetDatabase($this); $new->Drop(); $shout = new Shout(); $shout->SetDatabase($this); $shout->Drop(); $paragraph = new Paragraph(); $paragraph->SetDatabase($this); $paragraph->Drop(); $privilege = new Privilege(); $privilege->SetDatabase($this); $privilege->Drop(); $role = new Role(); $role->SetDatabase($this); $role->Drop(); $menu_item = new MenuItem(); $menu_item->SetDatabase($this); $menu_item->Drop(); $module = new Module(); $module->SetDatabase($this); $module->Drop(); $page = new Page(); $page->SetDatabase($this); $page->Drop(); $article = new Article(); $article->SetDatabase($this); $article->Drop(); $subject = new Subject(); $subject->SetDatabase($this); $subject->Drop(); $menu = new Menu(); $menu->SetDatabase($this); $menu->Drop(); $profile = new Profile(); $profile->SetDatabase($this); $profile->Drop(); $user = new User(); $user->SetDatabase($this); $user->Drop(); }
$privilege = new Privilege(); $privilege->SetDatabase($database); $privilege->Create(); break; case 14: $role = new Role(); $role->SetDatabase($database); $role->Create(); break; case 15: $menu_item = new MenuItem(); $menu_item->SetDatabase($database); $menu_item->Create(); break; case 16: $shout = new Shout(); $shout->SetDatabase($database); $shout->Create(); break; case 17: $user_info = new UserInfo(); $user_info->SetDatabase($database); $user_info->Create(); break; case 18: $topic = new Topic(); $topic->SetDatabase($database); $topic->Create(); break; case 19: $c_message = new Message();
* Last Updated: July 31, 2007 */ /* Dependencies * * require src/cdShout.php * */ $first_shout_id = 0; $last_shout_id = 0; if (isset($_POST["p_first_shout_id"])) { $first_shout_id = $_POST["p_first_shout_id"]; } if (isset($_POST["p_last_shout_id"])) { $last_shout_id = $_POST["p_last_shout_id"]; } $shout = new Shout(); $shout->SetDatabase($database); ?> <script language="Javascript"> function ChangePageBackShout(first_shout_id) { document.form_shout.p_first_shout_id.value = first_shout_id; document.form_shout.submit(); } function ChangePageForwardShout(last_shout_id) { document.form_shout.p_last_shout_id.value = last_shout_id; document.form_shout.submit();
$profile = new Profile(); $profile->SetDatabase($database); $profile->Backup($handle1, $handle2); $paragraph = new Paragraph(); $paragraph->SetDatabase($database); $paragraph->Backup($handle1, $handle2); $privilege = new Privilege(); $privilege->SetDatabase($database); $privilege->Backup($handle1, $handle2); $role = new Role(); $role->SetDatabase($database); $role->Backup($handle1, $handle2); $menu_item = new MenuItem(); $menu_item->SetDatabase($database); $menu_item->Backup($handle1, $handle2); $shout = new Shout(); $shout->SetDatabase($database); $shout->Backup($handle1, $handle2); $user_info = new UserInfo(); $user_info->SetDatabase($database); $user_info->Backup($handle1, $handle2); $topic = new Topic(); $topic->SetDatabase($database); $topic->Backup($handle1, $handle2); $c_message = new Message(); $c_message->SetDatabase($database); $c_message->Backup($handle1, $handle2); $moderator = new Moderator(); $moderator->SetDatabase($database); $moderator->Backup($handle1, $handle2); fclose($handle1);
public function saveAction() { try { $shout = $GLOBALS['shout'] = Horde_Registry::appInit('shout'); $vars = $this->vars; if (!($action = $vars->get('action'))) { throw new Shout_Exception("Invalid action requested."); } $account = $GLOBALS['session']->get('shout', 'curaccount_code'); $digit = $vars->get('digit'); $menu = $vars->get('menu'); $action = $vars->get('action'); if ($action == 'none') { // Remove the menu action and return $shout->dialplan->deleteMenuAction($account, $menu, $digit); return true; } $actions = Shout::getMenuActions(); if (!isset($actions[$action])) { throw new Shout_Exception('Invalid action requested.'); } $args = array(); foreach ($actions[$action]['args'] as $name => $info) { $args[$name] = $vars->get($name); } $shout->dialplan->saveMenuAction($account, $menu, $digit, $action, $args); return true; } catch (Exception $e) { //FIXME: Create a way to notify the user of the failure. Horde::log($e, 'ERR'); return false; } }
$user_tmp->SetDatabase($database); $user_tmp->SetUsername($guardian->GetUsername()); $user_tmp->SelectByName(); $user_id_tmp = $user_tmp->GetId(); if (isset($_POST["p_action"])) { $action = $_POST["p_action"]; $shou_id = $_POST["p_shou_id"]; $shou_date = $_POST["p_shou_date"]; $shou_text = $_POST["p_shou_text"]; $shou_user_id = $_POST["p_shou_user_id"]; $message = ""; if ($action == 1) { $date = new Date(); $date->SetConverted($shou_date); $date->ConvertToFullDate(); $shout = new Shout(); $shout->SetDatabase($database); $shout->SetDate($date->GetDate()); $shout->SetText($shou_text); $shout->SetUser($shou_user_id); if ($shout->Insert()) { $message = $screen_module_name . " incluído com sucesso."; $shou_id = ""; $shou_date = $date->GetNowFull(); $shou_text = ""; $shou_user_id = ""; } else { $message = "Problemas na operação."; } } }
<form name="form_query" method="post"> <tr> <td bgcolor="#EEEEEE" width="100%" valign="top" class="form_title" colspan="2"> Notícias </td> </tr> <tr> <td bgcolor="#FFFFFF" width="30%" valign="center" align="right"> Título: </td> <td bgcolor="#FFFFFF" width="70%" valign="center" align="left"> <select name="p_shou_id"> <option value="">Selecione</option> <?php $shout = new Shout(); $shout->SetDatabase($database); $result = $shout->Select(); while ($data = $database->FetchArray($result)) { $shou_id = $data["shou_id"]; echo "<option value=\"" . $shou_id . "\">" . $shou_id . "</option>"; } ?> </select> </td> </tr> <tr> <td bgcolor="#FFFFFF" width="100%" valign="center" align="center" colspan="2"> <a href="javascript:Select();">Selecionar</a> <a href="javascript:Close();">Fechar</a>