当前位置: 首页>>代码示例>>PHP>>正文


PHP AbstractDb::getObject方法代码示例

本文整理汇总了PHP中AbstractDb::getObject方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractDb::getObject方法的具体用法?PHP AbstractDb::getObject怎么用?PHP AbstractDb::getObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AbstractDb的用法示例。


在下文中一共展示了AbstractDb::getObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * Constructor
  *
  * @param string $content_id Content id     */
 protected function __construct($content_id)
 {
     $db = AbstractDb::getObject();
     // Init values
     $row = null;
     parent::__construct($content_id);
     $content_id = $db->escapeString($content_id);
     $sql = "SELECT * FROM content_file_image WHERE pictures_id='{$content_id}'";
     $db->execSqlUniqueRes($sql, $row, false);
     if ($row == null) {
         /*
          * Since the parent Content exists, the necessary data in
          * content_group had not yet been created
          */
         $sql = "INSERT INTO content_file_image (pictures_id) VALUES ('{$content_id}')";
         $db->execSqlUpdate($sql, false);
         $sql = "SELECT * FROM content_file_image WHERE pictures_id='{$content_id}'";
         $db->execSqlUniqueRes($sql, $row, false);
         if ($row == null) {
             throw new Exception(_("The content with the following id could not be found in the database: ") . $content_id);
         }
     }
     $this->mBd =& $db;
     $this->pictures_row = $row;
     $this->configEnableEditFilename(false);
     $this->configEnableEditMimeType(false);
 }
开发者ID:soitun,项目名称:wifidog-auth,代码行数:31,代码来源:Picture.php

示例2: __construct

 /**
  * Constructor
  *
  * @return void
  */
 public function __construct(&$network)
 {
     $db = AbstractDb::getObject();
     // Init network
     $this->_network = $network;
     $this->_csv_document = "";
     // Query the database, sorting by node name
     $db->execSql("SELECT *, (CURRENT_TIMESTAMP-last_heartbeat_timestamp) AS since_last_heartbeat, EXTRACT(epoch FROM creation_date) as creation_date_epoch, CASE WHEN ((CURRENT_TIMESTAMP-last_heartbeat_timestamp) < interval '5 minutes') THEN true ELSE false END AS is_up FROM nodes WHERE network_id = '" . $db->escapeString($this->_network->getId()) . "' AND (node_deployment_status = 'DEPLOYED' OR node_deployment_status = 'NON_WIFIDOG_NODE') ORDER BY lower(name)", $this->_nodes, false);
 }
开发者ID:cnlangzi,项目名称:wifidog-auth,代码行数:14,代码来源:NodeListJiWireCSV.php

示例3: getReportUI

 /** Get the actual report.
  * Classes must override this, but must call the parent's method with what
  * would otherwise be their return value and return that instead.
  * @param $child_html The child method's return value
  * @return A html fragment
  */
 public function getReportUI($child_html = null)
 {
     $db = AbstractDb::getObject();
     $html = '';
     $node_usage_stats = null;
     $distinguish_users_by = $this->stats->getDistinguishUsersBy();
     $candidate_connections_sql = $this->stats->getSqlCandidateConnectionsQuery("DISTINCT connections.{$distinguish_users_by}, connections.node_id, nodes.name, date_trunc('day', timestamp_in) as rounded_date");
     //$db->execSql($candidate_connections_sql, $tmp, true);
     $daily_visit_table_name = "daily_visit_table_name_" . session_id();
     $daily_visit_table_sql = "CREATE TEMP TABLE  {$daily_visit_table_name} AS ({$candidate_connections_sql});\n  \n";
     $daily_visit_table_sql .= "CREATE INDEX {$daily_visit_table_name}_idx ON {$daily_visit_table_name} (node_id)";
     $db->execSqlUpdate($daily_visit_table_sql, false);
     $daily_visit_table_sql = "SELECT COUNT ({$distinguish_users_by}) AS total_visits, node_id, name FROM {$daily_visit_table_name} GROUP BY node_id, name ORDER BY total_visits DESC;";
     $db->execSql($daily_visit_table_sql, $node_usage_stats, false);
     $daily_visit_table_sql = "DROP TABLE {$daily_visit_table_name};";
     $db->execSqlUpdate($daily_visit_table_sql, false);
     //		$candidate_connections_sql = $this->stats->getSqlCandidateConnectionsQuery("nodes.name,connections.node_id,COUNT(connections.node_id) AS connections ");
     //		$sql = "$candidate_connections_sql GROUP BY connections.node_id,nodes.name ORDER BY connections DESC";
     //		$db->execSql($sql, $node_usage_stats, false);
     if ($node_usage_stats) {
         $html .= "<table>";
         $html .= "<thead>";
         $html .= "<tr>";
         $html .= "  <th>" . _("Node") . "</th>";
         $html .= "  <th>" . _("Visits") . "</th>";
         $html .= "</tr>";
         $html .= "</thead>";
         $total = 0;
         $even = 0;
         foreach ($node_usage_stats as $row) {
             $html .= $even ? "<tr>\n" : "<tr class='odd'>\n";
             if ($even == 0) {
                 $even = 1;
             } else {
                 $even = 0;
             }
             $html .= "  <td>{$row['name']}</td>\n";
             $html .= "  <td>" . $row['total_visits'] . "</td>";
             $html .= "</tr>";
             $total += $row['total_visits'];
         }
         $html .= "<tfoot>";
         $html .= "<tr>";
         $html .= "  <th>" . _("Total") . ":</th>";
         $html .= "  <th>" . $total . "</th>";
         $html .= "</tr>";
         $html .= "<tr>";
         $html .= "  <td colspan=2>" . _("Note:  A visit is like counting connections, but only counting one connection per day for each user at a single node") . ":</td>";
         $html .= "</tr>";
         $html .= "</tfoot>";
         $html .= "</table>";
     } else {
         $html .= _("No information found matching the report configuration");
     }
     return parent::getReportUI($html);
 }
开发者ID:cnlangzi,项目名称:wifidog-auth,代码行数:62,代码来源:MostPopularNodes.php

示例4: getReportUI

 /** Get the actual report.
  * Classes must override this, but must call the parent's method with what
  * would otherwise be their return value and return that instead.
  * @param $child_html The child method's return value
  * @return A html fragment
  */
 public function getReportUI($child_html = null)
 {
     $db = AbstractDb::getObject();
     $html = '';
     $graph = StatisticGraph::getObject('ConnectionsPerHour');
     $html .= $graph->getReportUI($this->stats);
     $graph = StatisticGraph::getObject('VisitsPerWeekday');
     $html .= $graph->getReportUI($this->stats);
     $graph = StatisticGraph::getObject('VisitsPerMonth');
     $html .= $graph->getReportUI($this->stats);
     return parent::getReportUI($html);
 }
开发者ID:soitun,项目名称:wifidog-auth,代码行数:18,代码来源:ConnectionGraphs.php

示例5: getReportUI

 /** Get the actual report.
  * Classes must override this, but must call the parent's method with what
  * would otherwise be their return value and return that instead.
  * @param $child_html The child method's return value
  * @return A html fragment
  */
 public function getReportUI($child_html = null)
 {
     $db = AbstractDb::getObject();
     $html = '';
     $distinguish_users_by = $this->stats->getDistinguishUsersBy();
     $candidate_connections_sql = $this->stats->getSqlCandidateConnectionsQuery(" connections.{$distinguish_users_by}, SUM(incoming+outgoing) AS total, SUM(incoming) AS total_incoming, SUM(outgoing) AS total_outgoing ", false);
     $sql = "{$candidate_connections_sql} GROUP BY connections.{$distinguish_users_by} ORDER BY total DESC LIMIT " . self::NUM_USERS_TO_DISPLAY . "";
     $db->execSql($sql, $frequent_users_stats, false);
     if ($frequent_users_stats) {
         $html .= "<table>";
         $html .= "<thead>";
         $html .= "<tr>";
         if ($distinguish_users_by == 'user_id') {
             $caption = _("User (username)");
         } else {
             $caption = _("User (MAC address)");
         }
         $html .= "  <th>{$caption}</th>";
         $html .= "  <th>" . _("Incoming") . "</th>";
         $html .= "  <th>" . _("Outgoing") . "</th>";
         $html .= "  <th>" . _("Total") . "</th>";
         $html .= "</tr>";
         $html .= "</thead>";
         $even = 0;
         foreach ($frequent_users_stats as $row) {
             $html .= $even ? "<tr>\n" : "<tr class='odd'>\n";
             if ($even == 0) {
                 $even = 1;
             } else {
                 $even = 0;
             }
             if (!empty($row['user_id'])) {
                 $user = User::getObject($row['user_id']);
                 $display_id = $user->getUsername();
             } else {
                 //We only have a MAC address
                 $display_id = $row['user_mac'];
             }
             $html .= "  <td>{$display_id}</a></td>\n";
             $html .= "  <td>" . Utils::convertBytesToWords($row['total_incoming']) . "</td>";
             $html .= "  <td>" . Utils::convertBytesToWords($row['total_outgoing']) . "</td>";
             $html .= "  <td>" . Utils::convertBytesToWords($row['total']) . "</td>";
             $html .= "</tr>";
         }
         $html .= "</table>";
     } else {
         $html .= _("No information found matching the report configuration");
     }
     return parent::getReportUI($html);
 }
开发者ID:soitun,项目名称:wifidog-auth,代码行数:56,代码来源:HighestBandwidthUsers.php

示例6: getReportUI

 /** Get the actual report.
  * Classes must override this, but must call the parent's method with what
  * would otherwise be their return value and return that instead.
  * @param $child_html The child method's return value
  * @return A html fragment
  */
 public function getReportUI($child_html = null)
 {
     $db = AbstractDb::getObject();
     $html = '';
     $distinguish_users_by = $this->stats->getDistinguishUsersBy();
     $candidate_connections_sql = $this->stats->getSqlCandidateConnectionsQuery("DISTINCT {$distinguish_users_by}, date_trunc('day', timestamp_in) AS date");
     $sql = "SELECT COUNT(*) AS active_days, {$distinguish_users_by} FROM ({$candidate_connections_sql} GROUP BY date,{$distinguish_users_by}) AS user_active_days GROUP BY {$distinguish_users_by} ORDER BY active_days DESC LIMIT " . self::NUM_USERS_TO_DISPLAY . "";
     $db->execSql($sql, $frequent_users_stats, false);
     if ($frequent_users_stats) {
         $html .= "<table>";
         $html .= "<thead>";
         $html .= "<tr>";
         if ($distinguish_users_by == 'user_id') {
             $caption = _("User (username)");
         } else {
             $caption = _("User (MAC address)");
         }
         $html .= "  <th>{$caption}</th>";
         $html .= "  <th>" . _("Different days connected") . "</th>";
         $html .= "</tr>";
         $html .= "</thead>";
         $even = 0;
         foreach ($frequent_users_stats as $row) {
             $html .= $even ? "<tr>\n" : "<tr class='odd'>\n";
             if ($even == 0) {
                 $even = 1;
             } else {
                 $even = 0;
             }
             if (!empty($row['user_id'])) {
                 $user = User::getObject($row['user_id']);
                 $display_id = $user->getUsername();
             } else {
                 //We only have a MAC address
                 $display_id = $row['user_mac'];
             }
             $html .= "  <td>{$display_id}</a></td>\n";
             //$html .= "  <td><a href='?date_from={$_REQUEST['date_from']}&date_to={$_REQUEST['date_to']}&user_id={$row['user_id']}'>{$row['username']}</a></td>\n";
             $html .= "  <td>" . $row['active_days'] . "</td>";
             $html .= "</tr>";
         }
         $html .= "</table>";
     } else {
         $html .= _("No information found matching the report configuration");
     }
     return parent::getReportUI($html);
 }
开发者ID:soitun,项目名称:wifidog-auth,代码行数:53,代码来源:MostFrequentUsers.php

示例7: getReportUI

 /** Get the actual report.
  * Classes must override this, but must call the parent's method with what
  * would otherwise be their return value and return that instead.
  * @param $child_html The child method's return value
  * @return A html fragment
  */
 public function getReportUI($child_html = null)
 {
     $db = AbstractDb::getObject();
     $html = '';
     $distinguish_users_by = $this->stats->getDistinguishUsersBy();
     $candidate_connections_sql = $this->stats->getSqlCandidateConnectionsQuery("COUNT(DISTINCT connections.node_id) AS num_hotspots_visited, {$distinguish_users_by}");
     $sql = "{$candidate_connections_sql} GROUP BY {$distinguish_users_by} ORDER BY num_hotspots_visited DESC LIMIT " . self::NUM_USERS_TO_DISPLAY . "";
     $db->execSql($sql, $mobile_users_stats, false);
     if ($mobile_users_stats) {
         $html .= "<table>";
         $html .= "<thead>";
         $html .= "<tr>";
         if ($distinguish_users_by == 'user_id') {
             $caption = _("User (username)");
         } else {
             $caption = _("User (MAC address)");
         }
         $html .= "  <th>{$caption}</th>";
         $html .= "  <th>" . _("Nodes visited") . "</th>";
         $html .= "</tr>";
         $html .= "</thead>";
         $even = 0;
         foreach ($mobile_users_stats as $row) {
             $html .= $even ? "<tr>\n" : "<tr class='odd'>\n";
             if ($even == 0) {
                 $even = 1;
             } else {
                 $even = 0;
             }
             if (!empty($row['user_id'])) {
                 $user = User::getObject($row['user_id']);
                 $display_id = $user->getUsername();
             } else {
                 //We only have a MAC address
                 $display_id = $row['user_mac'];
             }
             $html .= "  <td>{$display_id}</a></td>\n";
             //$html .= "  <td><a href='?date_from={$_REQUEST['date_from']}&date_to={$_REQUEST['date_to']}&user_id={$row['user_id']}'>{$row['username']}</a></td>\n";
             $html .= "  <td>" . $row['num_hotspots_visited'] . "</td>";
             $html .= "</tr>";
         }
         $html .= "</table>";
     } else {
         $html .= _("No information found matching the report configuration");
     }
     return parent::getReportUI($html);
 }
开发者ID:cnlangzi,项目名称:wifidog-auth,代码行数:53,代码来源:MostMobileUsers.php

示例8: showImageData

 /** Return the actual Image data
  * Classes must override this.
  * @param $child_html The child method's return value
  * @return A html fragment
  */
 public function showImageData()
 {
     require_once "Image/Graph.php";
     $db = AbstractDb::getObject();
     $Graph =& Image_Graph::factory("Image_Graph", array(600, 200));
     $Plotarea =& $Graph->add(Image_Graph::factory("Image_Graph_Plotarea"));
     $Dataset =& Image_Graph::factory("Image_Graph_Dataset_Trivial");
     $Bar =& Image_Graph::factory("Image_Graph_Plot_Bar", $Dataset);
     $Bar->setFillColor("#9db8d2");
     $Plot =& $Plotarea->add($Bar);
     $candidate_connections_sql = self::$stats->getSqlCandidateConnectionsQuery("COUNT(distinct user_mac) AS connections, extract('hour' from timestamp_in) AS hour");
     $db->execSql("{$candidate_connections_sql} GROUP BY hour ORDER BY hour", $results, false);
     if ($results) {
         foreach ($results as $row) {
             $Dataset->addPoint($row['hour'] . "h", $row['connections']);
         }
     }
     $Graph->done();
 }
开发者ID:soitun,项目名称:wifidog-auth,代码行数:24,代码来源:ConnectionsPerHour.php

示例9: showImageData

 /** Return the actual Image data
  * Classes must override this.
  * @param $child_html The child method's return value
  * @return A html fragment
  */
 public function showImageData()
 {
     require_once "Image/Graph.php";
     $db = AbstractDb::getObject();
     $Graph =& Image_Graph::factory("Image_Graph", array(600, 200));
     $Plotarea =& $Graph->add(Image_Graph::factory("Image_Graph_Plotarea"));
     $Dataset =& Image_Graph::factory("Image_Graph_Dataset_Trivial");
     $Bar =& Image_Graph::factory("Image_Graph_Plot_Bar", $Dataset);
     $Bar->setFillColor("#9db8d2");
     $Plot =& $Plotarea->add($Bar);
     $total = 0;
     $network_constraint = self::$stats->getSqlNetworkConstraint('account_origin');
     $date_constraint = self::$stats->getSqlDateConstraint('reg_date');
     $db->execSql("SELECT COUNT(users) AS num_users, date_trunc('month', reg_date) AS month FROM users  WHERE account_status = " . ACCOUNT_STATUS_ALLOWED . " {$date_constraint} {$network_constraint} GROUP BY date_trunc('month', reg_date) ORDER BY month", $registration_stats, false);
     if ($registration_stats) {
         foreach ($registration_stats as $row) {
             $Dataset->addPoint(substr($row['month'], 0, 7), $row['num_users']);
         }
     }
     $Graph->done();
 }
开发者ID:soitun,项目名称:wifidog-auth,代码行数:26,代码来源:RegistrationsPerMonth.php

示例10: page_if_down_since

function page_if_down_since($nodeObject, $minutes)
{
    $db = AbstractDb::getObject();
    $last_heartbeat = strtotime($nodeObject->getLastHeartbeatTimestamp());
    $time = time();
    $downtime = round((time() - $last_heartbeat) / 60, 0);
    $paged_addresses = "";
    if ($time - $last_heartbeat > 60 * $minutes) {
        //If hostpot is down for longuer than the requested average interval
        $lastPaged = strtotime($nodeObject->getLastPaged());
        //echo sprintf("Node down for %f minutes, Last paged: %f minutes ago, difference between last page and last heartbeat: %s, difference must be less than %d minutes to page again <br/>\n", ($time-$last_heartbeat)/60, ($time-$lastPaged)/60, ($lastPaged - $last_heartbeat)/60, $minutes);
        if (!$nodeObject->getLastPaged() || !$lastPaged) {
            //If we can't retrieve or parse, pretend we last paged right before the hostpot went down
            $lastPaged = $last_heartbeat - 1;
        }
        if ($lastPaged < $last_heartbeat + 60 * $minutes) {
            //If we haven't paged since the downtime reached the threshold
            $network = $nodeObject->getNetwork();
            $nodeObject->setLastPaged(time());
            $usersToPage = $nodeObject->DEPRECATEDgetTechnicalOfficers();
            $usersMsg = null;
            foreach ($usersToPage as $officer) {
                # Doesn't work if called from cron
                #Locale :: setCurrentLocale(Locale::getObject($officer->getPreferedLocale()));
                $mail = new Mail();
                $mail->setSenderName(_("Monitoring system"));
                $mail->setSenderEmail($network->getTechSupportEmail());
                $mail->setRecipientEmail($officer->getEmail());
                $mail->setMessageSubject($minutes . " - " . $network->getName() . " " . _("node") . " " . $nodeObject->getName());
                $mail->setHighPriority(true);
                $mail->setMessageBody(sprintf(_("Node %s (%s) has been down for %d minutes (since %s)"), $nodeObject->getName(), $nodeObject->getId(), $minutes, date("r", $last_heartbeat)));
                $mailRetval = $mail->send();
                $usersMsg .= sprintf("%s: %s", $officer->getUsername(), $mailRetval ? _("Success") : _("Failed sending mail")) . "\n";
            }
            $msg = sprintf("Node %s has been DOWN for %d minutes, we mailed the following %d user(s):\n%s", $nodeObject->getName(), ($time - $last_heartbeat) / 60, count($usersToPage), $usersMsg);
            throw new exception($msg);
        }
        throw new exception(sprintf("Node %s has been DOWN for %d minutes (more than %d minutes), but we already notified everyone after %d minutes." . "\n", $nodeObject->getName(), ($time - $last_heartbeat) / 60, $minutes, ($lastPaged - $last_heartbeat) / 60));
    }
}
开发者ID:soitun,项目名称:wifidog-auth,代码行数:40,代码来源:page.php

示例11: getUserUI

 /** Retreives the user interface of this object.  Anything that overrides this method should call the parent method with it's output at the END of processing.
  * @return The HTML fragment for this interface */
 public function getUserUI()
 {
     $real_node = Node::getCurrentRealNode();
     //For production
     //$real_node = Node::getCurrentNode();//For testing
     $node = Node::getCurrentNode();
     $formHtml = null;
     if ($real_node) {
         $formHtml .= "<form action='" . BASE_URL_PATH . "content/ShoutBox/add_message.php'>\n";
         $formHtml .= "<input type='hidden' name='shoutbox_id' value='" . $this->getId() . "'/>\n";
         //$html .= "destination_url: ";pretty_print_r($_SERVER);
         $maxShoutChars = $this->getMaxShoutChars();
         $shoutFieldSize = $this->getShoutFieldSize();
         if ($maxShoutChars > 0) {
             $max_size = "maxlength='{$maxShoutChars}'";
             $maxShoutChars <= $shoutFieldSize ? $size = "size='{$maxShoutChars}'" : ($size = "size='{$shoutFieldSize}'");
         } else {
             $max_size = null;
             $size = "size='{$shoutFieldSize}'";
         }
         $formHtml .= "<input type='hidden' name='node_id' value='" . $node->getId() . "'/>\n";
         $formHtml .= "<input type='text' name='shout_text' id='shout_text' {$size} {$max_size} value=''/>\n";
         $onclick_content = $this->getOnClickContent();
         if ($onclick_content) {
             $onclick = "onclick=\"" . $onclick_content->getString() . "\"";
         } else {
             $onclick = null;
         }
         $formHtml .= "<input type='submit' name='shout_submit' {$onclick} value='" . _("Shout!") . "'>\n";
         $formHtml .= "</form>\n";
     } else {
         $formHtml .= "<p>" . _("Sorry, you must be at a hotspot to use the shoutbox") . "</p>\n";
     }
     $html_main = '';
     $displayNumItems = $this->getDisplayNumItems();
     $db = AbstractDb::getObject();
     if ($node) {
         $node_id = $db->escapeString($node->getId());
         if ($displayNumItems > 0) {
             $limit = "LIMIT {$displayNumItems}";
             $heading = "<em>" . sprintf(_("Last %d messages:"), $displayNumItems) . "</em>";
         } else {
             $limit = null;
             $heading = null;
         }
         $sql = "SELECT *, EXTRACT(EPOCH FROM creation_date) as creation_date_php FROM content_shoutbox_messages WHERE origin_node_id='{$node_id}' ORDER BY creation_date DESC {$limit}\n";
         $db->execSql($sql, $rows, false);
         $html_main .= "<ul>";
         $html_main .= "<li>{$formHtml}</li>";
         if ($rows) {
             //$html_main .= $heading;
             foreach ($rows as $row) {
                 $user = User::getObject($row['author_user_id']);
                 $content = Content::getObject($row['message_content_id']);
                 $html_main .= "<li>";
                 $dateStr = "<span class='date'>" . strftime('%x', $row['creation_date_php']) . "</span>\n";
                 $html_main .= $dateStr . ' ' . $user->getListUI() . ": \n";
                 $html_main .= "<div class='message'>" . $content->getListUI() . "</div>\n";
                 $html_main .= "</li>";
             }
         }
         $html_main .= "</ul>";
     } else {
         $html_main .= "<p>" . _("Sorry, I am unable to determine your current node") . "</p>\n";
     }
     $this->setUserUIMainDisplayContent($html_main);
     //$this->setUserUIMainInteractionArea($formHtml);
     return Content::getUserUI();
 }
开发者ID:cnlangzi,项目名称:wifidog-auth,代码行数:71,代码来源:ShoutBox.php

示例12: getAllContent

 function getAllContent()
 {
     $db = AbstractDb::getObject();
     $retval = array();
     $content_rows = null;
     $sql = "SELECT * FROM user_has_content WHERE user_id='{$this->id}' ORDER BY subscribe_timestamp";
     $db->execSql($sql, $content_rows, false);
     if ($content_rows != null) {
         foreach ($content_rows as $content_row) {
             $retval[] = Content::getObject($content_row['content_id']);
         }
     }
     return $retval;
 }
开发者ID:soitun,项目名称:wifidog-auth,代码行数:14,代码来源:User.php

示例13: processFeedAdminUI

 /**
  * Feed-specific section of the admin interface
  *
  * @param array $feed_row The database row of the content_rss_aggregator_feeds table
  *
  * @return void
  */
 private function processFeedAdminUI($feed_row)
 {
     $db = AbstractDb::getObject();
     $original_url = $db->escapeString($feed_row['url']);
     /*
      * bias
      */
     $name = "rss_aggregator_" . $this->id . "_feed_" . md5($feed_row['url']) . "_bias";
     $original_bias = $db->escapeString($feed_row['bias']);
     $bias = $db->escapeString($_REQUEST[$name]);
     if (is_numeric($bias) && $bias > 0 && $bias != $original_bias) {
         /*
          * Only update database if the mode is valid and there is an actual change
          */
         $db->execSqlUpdate("UPDATE content_rss_aggregator_feeds SET bias = '{$bias}' WHERE content_id = '{$this->id}' AND url='{$original_url}'", false);
         $this->refresh();
     } elseif (!is_numeric($bias) || $bias <= 0) {
         echo _("The bias must be a positive real number");
     } else {
         /*
          * Successfull, but nothing modified
          */
     }
     /*
      * default_publication_interval
      */
     $name = "rss_aggregator_" . $this->id . "_feed_" . md5($feed_row['url']) . "_default_publication_interval";
     if (isset($_REQUEST[$name])) {
         $original_default_publication_interval = $db->escapeString($feed_row['default_publication_interval']);
         $default_publication_interval = $db->escapeString($_REQUEST[$name] * (60 * 60 * 24));
         if ((empty($default_publication_interval) || is_numeric($default_publication_interval) && $default_publication_interval > 0) && $default_publication_interval != $original_default_publication_interval) {
             /*
              * Only update database if the mode is valid and there is an actual change
              */
             if (empty($default_publication_interval)) {
                 $default_publication_interval = 'NULL';
             }
             $db->execSqlUpdate("UPDATE content_rss_aggregator_feeds SET default_publication_interval = {$default_publication_interval} WHERE content_id = '{$this->id}' AND url='{$original_url}'", false);
             $this->refresh();
         } elseif (!is_numeric($bias) || $bias <= 0) {
             echo _("The default publication must must be a positive integer or empty");
         } else {
             /*
              * Successfull, but nothing modified
              */
         }
     }
     /*
      * URL, we must change it last or we won't find the row again
      */
     $name = "rss_aggregator_" . $this->id . "_feed_" . md5($feed_row['url']) . "_url";
     $url = $db->escapeString($_REQUEST[$name]);
     if (!empty($url) && $url != $feed_row['url']) {
         /*
          * Only update database if the mode is valid and there is an actual change
          */
         $db->execSqlUpdate("UPDATE content_rss_aggregator_feeds SET url = '{$url}' WHERE content_id = '{$this->id}' AND url='{$original_url}'", false);
         $this->refresh();
     } elseif (empty($url)) {
         echo _("The URL cannot be empty!");
     } else {
         /*
          * Successfull, but nothing modified
          */
     }
 }
开发者ID:soitun,项目名称:wifidog-auth,代码行数:73,代码来源:RssAggregator.php

示例14: isDisplayableAt

 /**
  * Returns if this this Content element is displayable at this hotspot
  *
  * @param string $node Node Id
  *
  * @return bool True if it is displayable
  */
 public function isDisplayableAt($node)
 {
     $db = AbstractDb::getObject();
     // Init values
     $retval = false;
     $allowed_node_rows = null;
     $sql = "SELECT * FROM content_group_element_has_allowed_nodes WHERE content_group_element_id='{$this->id}'";
     $db->execSql($sql, $allowed_node_rows, false);
     if ($allowed_node_rows != null) {
         if ($node) {
             $node_id = $node->getId();
             /**
              * @todo  Proper algorithm, this is a dirty and slow hack
              */
             foreach ($allowed_node_rows as $allowed_node_row) {
                 if ($allowed_node_row['node_id'] == $node_id) {
                     $retval = true;
                 }
             }
         } else {
             /* There are allowed nodes, but we don't know at which node we want to display */
             $retval = false;
         }
     } else {
         /* No allowed node means all nodes are allowed */
         $retval = true;
     }
     return $retval;
 }
开发者ID:soitun,项目名称:wifidog-auth,代码行数:36,代码来源:ContentGroupElement.php

示例15: _delete

 /**
  * Function called by the children of this class to delete the parent element form the graph
  * @param unknown_type $errmsg
  * @return unknown_type
  */
 protected function _delete(&$errmsg)
 {
     // Init values
     $retval = false;
     $db = AbstractDb::getObject();
     $id = $db->escapeString($this->getHgeId());
     if (!$db->execSqlUpdate("DELETE FROM hotspot_graph_elements WHERE hotspot_graph_element_id='{$id}'", false)) {
         $errmsg = _('Could not delete graph element!');
     } else {
         $retval = true;
     }
     return $retval;
 }
开发者ID:cnlangzi,项目名称:wifidog-auth,代码行数:18,代码来源:HotspotGraphElement.php


注:本文中的AbstractDb::getObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。