• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP AbstractDb类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: self

 /** Note that you should call the first instance of AbstractDb as soon as possible to get reliable SQL vs PHP statistics.*/
 public static function &getObject()
 {
     if (self::$object == null) {
         self::$object = new self();
     }
     return self::$object;
 }
开发者ID:cnlangzi,项目名称:wifidog-auth,代码行数:8,代码来源:AbstractDb.php


示例2: __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


示例3: __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


示例4: PhpCIdb

	function PhpCIdb() {
		parent::AbstractDb();
		//load the database settings from the config file
		//uses $this->db for convenience
		$CI =& get_instance();
		$CI->load->database();
		$this->db = &$CI->db;
		$this->base_path = $CI->config->item('absolute_path');
	}
开发者ID:rtraction,项目名称:Compost,代码行数:9,代码来源:PhpCIdb.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 = '';
     $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


示例6: CompostDb

	function CompostDb() {
		parent::AbstractDb();
		$CI =& get_instance();
		if($CI->config->item('use_txt_db')){
			$CI->load->library('phptxtdb');
			$this->db = &$CI->phptxtdb;
		} else {
			$CI->load->library('phpcidb');
			$this->db = &$CI->phpcidb;
		}
	}
开发者ID:rtraction,项目名称:Compost,代码行数:11,代码来源:CompostDb.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 = '';
     $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


示例8: 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


示例9: 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


示例10: 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


示例11: 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


示例12: 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


示例13: 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


示例14: real_update_schema

/**
 * Try to bring the database schema up to date.
 * @param $schema_version The target schema
 * @return void
 */
function real_update_schema($targetSchema)
{
    $sql = '';
    $db = AbstractDb::getObject();
    $db->execSqlUniqueRes("SELECT * FROM schema_info WHERE tag='schema_version'", $row, false);
    //Re-check the schema version, it could have been updated by another thread
    $schema_version = $row['value'];
    $new_schema_version = 2;
    if ($schema_version < $new_schema_version && $new_schema_version <= $targetSchema && $new_schema_version <= $targetSchema) {
        printUpdateVersion($new_schema_version);
        $sql .= "\n\nUPDATE schema_info SET value='{$new_schema_version}' WHERE tag='schema_version';\n";
        $sql .= "ALTER TABLE users ADD COLUMN username text;\n";
        $sql .= "ALTER TABLE users ADD COLUMN account_origin text;\n";
        $db->execSql("SELECT user_id FROM users", $results, false);
        foreach ($results as $row) {
            $user_id = $db->escapeString($row['user_id']);
            $sql .= "UPDATE users SET username='{$user_id}', user_id='" . get_guid() . "', account_origin='LOCAL_USER' WHERE user_id='{$user_id}';\n";
        }
        $sql .= "CREATE UNIQUE INDEX idx_unique_username_and_account_origin ON users (username, account_origin);\n";
        $sql .= "CREATE UNIQUE INDEX idx_unique_email_and_account_origin ON users USING btree (email, account_origin);\n";
    }
    $new_schema_version = 3;
    if ($schema_version < $new_schema_version && $new_schema_version <= $targetSchema && $new_schema_version <= $targetSchema) {
        printUpdateVersion($new_schema_version);
        $sql .= "\n\nUPDATE schema_info SET value='{$new_schema_version}' WHERE tag='schema_version';\n";
        $sql .= "DROP INDEX idx_unique_email_and_account_origin;\n";
        $sql .= "ALTER TABLE users DROP CONSTRAINT check_email_not_empty;\n";
    }
    $new_schema_version = 4;
    if ($schema_version < $new_schema_version && $new_schema_version <= $targetSchema) {
        printUpdateVersion($new_schema_version);
        $sql .= "\n\nUPDATE schema_info SET value='{$new_schema_version}' WHERE tag='schema_version';\n";
        $sql .= "ALTER TABLE users ALTER COLUMN account_origin SET NOT NULL;\n";
        $sql .= "ALTER TABLE users ADD CONSTRAINT check_account_origin_not_empty CHECK (account_origin::text <> ''::text);\n";
        // We must skip all other updates because schema 5 must be manually updated:
        $schema_version = 1000000;
    }
    $new_schema_version = 5;
    if ($schema_version == $new_schema_version - 1) {
        echo "<h1>Recoding database from ISO-8859-1 to UTF-8</h1>";
        echo "<h1>YOU MUST EXECUTE THESE COMMANDS FROM THE COMMAND_LINE:</h1>";
        echo "pg_dump wifidog -U wifidog > wifidog_dump.sql;<br>";
        echo "dropdb wifidog -U wifidog; <br>";
        echo "createdb --encoding=UNICODE --template=template0 -U wifidog wifidog;<br>";
        echo "psql wifidog -U wifidog < wifidog_dump.sql;<br>\n";
        echo " (Note: You may ignore the following errors:  \"ERROR:  permission denied to set session authorization\" and \"ERROR:  must be owner of schema public\")<br>";
        echo "psql wifidog -U wifidog -c \"UPDATE schema_info SET value='{$new_schema_version}' WHERE tag='schema_version'\";<br>";
        exit;
    }
    $new_schema_version = 6;
    if ($schema_version < $new_schema_version && $new_schema_version <= $targetSchema) {
        printUpdateVersion($new_schema_version);
        $sql .= "\n\nUPDATE schema_info SET value='{$new_schema_version}' WHERE tag='schema_version';\n";
        $sql .= "CREATE TABLE locales ( \n";
        $sql .= "  locales_id text PRIMARY KEY \n";
        $sql .= "  ); \n";
        $sql .= "  INSERT INTO locales VALUES ('fr'); \n";
        $sql .= "  INSERT INTO locales VALUES ('en'); \n";
        $sql .= "ALTER TABLE users ADD COLUMN never_show_username bool;\n";
        $sql .= "ALTER TABLE users ALTER COLUMN never_show_username SET DEFAULT FALSE;\n";
        $sql .= "ALTER TABLE users ADD COLUMN real_name text;\n";
        $sql .= "ALTER TABLE users ALTER COLUMN real_name SET DEFAULT NULL;\n";
        $sql .= "ALTER TABLE users ADD COLUMN website text;\n";
        $sql .= "ALTER TABLE users ALTER COLUMN website SET DEFAULT NULL;\n";
        $sql .= "ALTER TABLE users ADD COLUMN prefered_locale text REFERENCES locales ON DELETE SET NULL ON UPDATE CASCADE;\n";
        $sql .= "\n                                                CREATE TABLE content\n                                                (\n                                                content_id text NOT NULL PRIMARY KEY,\n                                                content_type text NOT NULL  CONSTRAINT content_type_not_empty_string CHECK (content_type != ''),\n                                                title text REFERENCES content ON DELETE RESTRICT ON UPDATE CASCADE,\n                                                description text REFERENCES content ON DELETE RESTRICT ON UPDATE CASCADE,\n                                                project_info text REFERENCES content ON DELETE RESTRICT ON UPDATE CASCADE,\n                                                sponsor_info text REFERENCES content ON DELETE RESTRICT ON UPDATE CASCADE,\n                                                creation_timestamp timestamp DEFAULT now()\n                                                );\n                                \n                                                CREATE TABLE content_has_owners\n                                                (\n                                                content_id text NOT NULL REFERENCES content ON DELETE CASCADE ON UPDATE CASCADE,\n                                                user_id text NOT NULL REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE,\n                                                is_author bool NOT NULL,\n                                                owner_since timestamp DEFAULT now(),\n                                                PRIMARY KEY  (content_id, user_id)\n                                                );\n                                \n                                                CREATE TABLE langstring_entries (\n                                                  langstring_entries_id text NOT NULL PRIMARY KEY,\n                                                  langstrings_id text REFERENCES content ON DELETE CASCADE ON UPDATE CASCADE,\n                                                  locales_id text REFERENCES locales ON DELETE RESTRICT ON UPDATE CASCADE,\n                                                  value text  DEFAULT ''\n                                                );\n                                \n                                                CREATE TABLE content_group (\n                                                  content_group_id text NOT NULL PRIMARY KEY REFERENCES content ON DELETE CASCADE ON UPDATE CASCADE,\n                                                  is_artistic_content bool NOT NULL DEFAULT FALSE,\n                                                  is_locative_content bool NOT NULL DEFAULT FALSE,\n                                                  content_selection_mode text\n                                                );\n                                \n                                                CREATE TABLE content_group_element (\n                                                  content_group_element_id text NOT NULL PRIMARY KEY REFERENCES content ON DELETE CASCADE ON UPDATE CASCADE,\n                                                  content_group_id text NOT NULL REFERENCES content_group ON DELETE CASCADE ON UPDATE CASCADE,\n                                                  display_order integer DEFAULT '1',\n                                                  displayed_content_id text REFERENCES content ON DELETE CASCADE ON UPDATE CASCADE,\n                                                  force_only_allowed_node bool\n                                                );\n                                                CREATE INDEX idx_content_group_element_content_group_id ON content_group_element (content_group_id);\n                                \n                                                CREATE TABLE content_group_element_has_allowed_nodes\n                                                (\n                                                content_group_element_id text NOT NULL REFERENCES content_group_element ON DELETE CASCADE ON UPDATE CASCADE,\n                                                node_id text NOT NULL REFERENCES nodes ON DELETE CASCADE ON UPDATE CASCADE,\n                                                allowed_since timestamp DEFAULT now(),\n                                                PRIMARY KEY  (content_group_element_id, node_id)\n                                                );\n                                \n                                                CREATE TABLE content_group_element_portal_display_log (\n                                                  user_id text NOT NULL REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE,\n                                                  content_group_element_id text NOT NULL REFERENCES content_group_element ON DELETE CASCADE ON UPDATE CASCADE,\n                                                  display_timestamp timestamp NOT NULL DEFAULT now(),\n                                                  node_id text REFERENCES nodes ON DELETE CASCADE ON UPDATE CASCADE,\n                                                  PRIMARY KEY  (user_id,content_group_element_id, display_timestamp)\n                                                );\n                                \n                                                CREATE TABLE user_has_content (\n                                                  user_id text NOT NULL REFERENCES users ON DELETE CASCADE ON UPDATE CASCADE,\n                                                  content_id text NOT NULL REFERENCES content ON DELETE CASCADE ON UPDATE CASCADE,\n                                                  subscribe_timestamp timestamp NOT NULL DEFAULT now(),\n                                                  PRIMARY KEY  (user_id,content_id)\n                                                );\n                                \n                                                CREATE TABLE node_has_content (\n                                                  node_id text NOT NULL REFERENCES nodes ON DELETE CASCADE ON UPDATE CASCADE,\n                                                  content_id text NOT NULL REFERENCES content ON DELETE CASCADE ON UPDATE CASCADE,\n                                                  subscribe_timestamp timestamp NOT NULL DEFAULT now(),\n                                                  PRIMARY KEY  (node_id,content_id)\n                                                );\n                                \n                                                CREATE TABLE network_has_content (\n                                                  network_id text NOT NULL,\n                                                  content_id text NOT NULL REFERENCES content ON DELETE CASCADE ON UPDATE CASCADE,\n                                                  subscribe_timestamp timestamp NOT NULL DEFAULT now(),\n                                                  PRIMARY KEY  (network_id,content_id)\n                                                );";
    }
    $new_schema_version = 7;
    if ($schema_version < $new_schema_version && $new_schema_version <= $targetSchema) {
        printUpdateVersion($new_schema_version);
        $sql .= "\n\nUPDATE schema_info SET value='{$new_schema_version}' WHERE tag='schema_version';\n";
        $sql .= "ALTER TABLE content ADD COLUMN is_persistent bool;\n";
        $sql .= "ALTER TABLE content ALTER COLUMN is_persistent SET DEFAULT FALSE;\n";
    }
    $new_schema_version = 8;
    if ($schema_version < $new_schema_version && $new_schema_version <= $targetSchema) {
        printUpdateVersion($new_schema_version);
        $sql .= "\n\nUPDATE schema_info SET value='{$new_schema_version}' WHERE tag='schema_version';\n";
        $sql .= "CREATE TABLE flickr_photostream\n                                                        (\n                                                          flickr_photostream_id text NOT NULL,\n                                                          api_key text,\n                                                          photo_selection_mode text NOT NULL DEFAULT 'PSM_GROUP'::text,\n                                                          user_id text,\n                                                          user_name text,\n                                                          tags text,\n                                                          tag_mode varchar(10) DEFAULT 'any'::character varying,\n                                                          group_id text,\n                                                          random bool NOT NULL DEFAULT true,\n                                                          min_taken_date timestamp,\n                                                          max_taken_date timestamp,\n                                                          photo_batch_size int4 DEFAULT 10,\n                                                          photo_count int4 DEFAULT 1,\n                                                          display_title bool NOT NULL DEFAULT true,\n                                                          display_description bool NOT NULL DEFAULT false,\n                                                          display_tags bool NOT NULL DEFAULT false,\n                                                          CONSTRAINT flickr_photostream_pkey PRIMARY KEY (flickr_photostream_id),\n                                                          CONSTRAINT flickr_photostream_content_group_fkey FOREIGN KEY (flickr_photostream_id) REFERENCES content_group (content_group_id) ON UPDATE CASCADE ON DELETE CASCADE\n                                                        );";
    }
    $new_schema_version = 9;
    if ($schema_version < $new_schema_version && $new_schema_version <= $targetSchema) {
        printUpdateVersion($new_schema_version);
        $sql .= "\n\nUPDATE schema_info SET value='{$new_schema_version}' WHERE tag='schema_version';\n";
        $sql .= "CREATE TABLE files\n                                                        (\n                                                          files_id text NOT NULL,\n                                                          filename text,\n                                                          mime_type text,\n                                                          binary_data bytea,\n                                                          remote_size bigint,\n                                                          CONSTRAINT files_pkey PRIMARY KEY (files_id)\n                                                        );";
    }
    $new_schema_version = 10;
    if ($schema_version < $new_schema_version && $new_schema_version <= $targetSchema) {
        printUpdateVersion($new_schema_version);
        $sql .= "\n\nUPDATE schema_info SET value='{$new_schema_version}' WHERE tag='schema_version';\n";
        $sql .= "ALTER TABLE files ADD COLUMN url text;";
        $sql .= "ALTER TABLE flickr_photostream ADD COLUMN preferred_size text;";
        $sql .= "CREATE TABLE embedded_content (\n                                                            embedded_content_id text NOT NULL,\n                                                            embedded_file_id text,\n                                                            fallback_content_id text,\n                                                            parameters text,\n                                                            attributes text\n                                                        );";
    }
    $new_schema_version = 11;
//.........这里部分代码省略.........
开发者ID:cnlangzi,项目名称:wifidog-auth,代码行数:101,代码来源:schema_validate.php


示例15: 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


示例16: isDisplayableAt

 /**
  * Returns if this this Content element is displayable at this hotspo 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP AbstractEntity类代码示例发布时间:2022-05-23
下一篇:
PHP AbstractController类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap