public function run()
 {
     if (!ini_get('safe_mode')) {
         //ooh we can process for sooo long
         set_time_limit(280);
     }
     //get the required classes
     $config =& singleton::get(__NAMESPACE__ . '\\config');
     $plugins =& singleton::get(__NAMESPACE__ . '\\plugins');
     //don't want to stop processing when the http client disconnects
     ignore_user_abort(TRUE);
     //stop from running over and over again
     define('RUNNING_CRON', TRUE);
     //get the cron intervals
     $cron_intervals = $config->get('cron_intervals');
     if (!is_array($cron_intervals)) {
         exit;
     }
     //update intervals first so that slow processing tasks don't hold up the update of the intervals.
     $update_intervals = $cron_intervals;
     $datetime = datetime();
     foreach ($update_intervals as &$update_interval) {
         if ($update_interval['next_run'] < $datetime) {
             $update_interval['next_run'] = datetime($update_interval['frequency']);
         }
     }
     //update cron intervals
     $config->set('cron_intervals', $update_intervals);
     //now to the processing
     foreach ($cron_intervals as $cron_interval) {
         if ($cron_interval['next_run'] < $datetime) {
             $plugins->run('cron_' . $cron_interval['name']);
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * 更新用户的最后一次登录ip和时间
  * @access public
  * @param integer $user_id 用户id
  */
 public function updateLoginData($user_id)
 {
     $map['user_id'] = $user_id;
     $map['last_login_ip'] = get_client_ip();
     $map['last_login_time'] = datetime();
     $this->save($map);
 }
 function add($array)
 {
     global $db;
     if (!isset($array['start_date'])) {
         $array['start_date'] = '0000-00-00 00:00:00';
     }
     $tables =& singleton::get(__NAMESPACE__ . '\\tables');
     $error =& singleton::get(__NAMESPACE__ . '\\error');
     //we require an array
     if (!is_array($array['data'])) {
         return false;
     }
     reset($array['data']);
     $queue_data = \base64_encode(\serialize($array['data']));
     $queue_date = datetime();
     $site_id = SITE_ID;
     $query = "INSERT INTO {$tables->queue} (data, type, start_date, date, site_id) VALUES (:data, :type, :start_date, :date, :site_id)";
     try {
         $stmt = $db->prepare($query);
     } catch (\Exception $e) {
         $error->create(array('type' => 'sql_prepare_error', 'message' => $e->getMessage()));
     }
     $stmt->bindParam(':data', $queue_data, database::PARAM_STR);
     $stmt->bindParam(':type', $array['type'], database::PARAM_STR);
     $stmt->bindParam(':start_date', $array['start_date'], database::PARAM_STR);
     $stmt->bindParam(':date', $queue_date, database::PARAM_STR);
     $stmt->bindParam(':site_id', $site_id, database::PARAM_STR);
     try {
         $stmt->execute();
     } catch (\Exception $e) {
         $error->create(array('type' => 'sql_execute_error', 'message' => $e->getMessage()));
     }
     return true;
 }
 public function getDeadline($deadline)
 {
     if ('now' == I('request.create_time_choose')) {
         return datetime('now');
     } else {
         return datetime($deadline);
     }
 }
Ejemplo n.º 5
0
 /**
  * Function: like
  * Adds a like to the database.
  */
 public function like()
 {
     if ($this->action == "like" and $this->post_id > 0) {
         SQL::current()->insert("likes", array("post_id" => $this->post_id, "user_id" => $this->user_id, "timestamp" => datetime(), "session_hash" => $this->session_hash));
     } else {
         throw new Exception("invalid params- action = {$this->action} and post_id = {$this->post_id}");
     }
 }
Ejemplo n.º 6
0
 public function main_index($main)
 {
     $config = Config::current();
     if ($config->disable_aggregation or time() - $config->last_aggregation < $config->aggregate_every * 60) {
         return;
     }
     $aggregates = (array) $config->aggregates;
     if (empty($aggregates)) {
         return;
     }
     foreach ($aggregates as $name => $feed) {
         $xml_contents = preg_replace(array("/<(\\/?)dc:date>/", "/xmlns=/"), array("<\\1date>", "a="), get_remote($feed["url"]));
         $xml = simplexml_load_string($xml_contents, "SimpleXMLElement", LIBXML_NOCDATA);
         if ($xml === false) {
             continue;
         }
         # Flatten namespaces recursively
         $this->flatten($xml);
         $items = array();
         if (isset($xml->entry)) {
             foreach ($xml->entry as $entry) {
                 array_unshift($items, $entry);
             }
         } elseif (isset($xml->item)) {
             foreach ($xml->item as $item) {
                 array_unshift($items, $item);
             }
         } else {
             foreach ($xml->channel->item as $item) {
                 array_unshift($items, $item);
             }
         }
         foreach ($items as $item) {
             $date = oneof(@$item->pubDate, @$item->date, @$item->updated, 0);
             $updated = strtotime($date);
             if ($updated > $feed["last_updated"]) {
                 # Get creation date ('created' in Atom)
                 $created = @$item->created ? strtotime($item->created) : 0;
                 if ($created <= 0) {
                     $created = $updated;
                 }
                 # Construct the post data from the user-defined XPath mapping:
                 $data = array("aggregate" => $name);
                 foreach ($feed["data"] as $attr => $field) {
                     $field = !empty($field) ? $this->parse_field($field, $item) : "";
                     $data[$attr] = is_string($field) ? $field : YAML::dump($field);
                 }
                 if (isset($data["title"]) or isset($data["name"])) {
                     $clean = sanitize(oneof(@$data["title"], @$data["name"]));
                 }
                 Post::add($data, $clean, null, $feed["feather"], $feed["author"], false, "public", datetime($created), datetime($updated));
                 $aggregates[$name]["last_updated"] = $updated;
             }
         }
     }
     $config->set("aggregates", $aggregates);
     $config->set("last_aggregation", time());
 }
Ejemplo n.º 7
0
 static function mail_digest($to, $subject, $message, $headers)
 {
     $output = "\r\n" . $headers . "\r\n" . "To: " . $to . "\r\n" . "Date: " . datetime() . "\r\n" . "Subject: " . $subject . "\r\n\r\n" . $message . "\r\n\r\n" . "---correspondence---\r\n";
     if (@file_put_contents(MAIN_DIR . DIR . "digest.txt.php", $output, FILE_APPEND)) {
         return true;
     } else {
         return false;
     }
 }
 public function add($array)
 {
     global $db;
     $tables =& singleton::get(__NAMESPACE__ . '\\tables');
     $error =& singleton::get(__NAMESPACE__ . '\\error');
     $notifications =& singleton::get(__NAMESPACE__ . '\\notifications');
     $messages =& singleton::get(__NAMESPACE__ . '\\messages');
     $site_id = SITE_ID;
     $date_added = datetime();
     $query = "INSERT INTO {$tables->message_notes} (user_id, site_id, date_added";
     if (isset($array['message_id'])) {
         $query .= ", message_id";
     }
     if (isset($array['message'])) {
         $query .= ", message";
     }
     $query .= ") VALUES (:user_id, :site_id, :date_added";
     if (isset($array['message_id'])) {
         $query .= ", :message_id";
     }
     if (isset($array['message'])) {
         $query .= ", :message";
     }
     $query .= ")";
     try {
         $stmt = $db->prepare($query);
     } catch (\Exception $e) {
         $error->create(array('type' => 'sql_prepare_error', 'message' => $e->getMessage()));
     }
     $stmt->bindParam(':user_id', $array['user_id'], database::PARAM_INT);
     $stmt->bindParam(':site_id', $site_id, database::PARAM_INT);
     $stmt->bindParam(':date_added', $date_added, database::PARAM_STR);
     if (isset($array['message_id'])) {
         $stmt->bindParam(':message_id', $array['message_id'], database::PARAM_INT);
     }
     if (isset($array['message'])) {
         $stmt->bindParam(':message', $array['message'], database::PARAM_STR);
     }
     try {
         $stmt->execute();
         $id = $db->lastInsertId();
         if (isset($array['message_id'])) {
             $messages->edit(array('id' => $array['message_id']));
         }
         $notifications->new_message_note(array('user_id' => $array['user_id']));
         return $id;
     } catch (\PDOException $e) {
         $error->create(array('type' => 'sql_execute_error', 'message' => $e->getMessage()));
     }
 }
Ejemplo n.º 9
0
 public function __construct($user = null)
 {
     $this->_db = DB::getInstance();
     $this->_sessionName = Config::get('session/session_name');
     $this->_cookieName = Config::get('remember/cookie_name');
     if (!$user) {
         if (Session::exists($this->_sessionName)) {
             $user = Session::get($this->_sessionName);
             if ($this->find($user)) {
                 $this->_isLoggedIn = true;
                 $this->update(array('LastLogin' => datetime()));
             }
         }
     } else {
         $this->find($user);
     }
 }
Ejemplo n.º 10
0
 public function update($filename = null, $path = null, $entity_type = null, $entity_id = null)
 {
     if ($this->no_results) {
         return false;
     }
     $sql = SQL::current();
     $trigger = Trigger::current();
     $old = clone $this;
     foreach (array("filename", "path", "entity_type", "entity_id") as $attr) {
         if ($attr == "updated_at" and $updated_at === null) {
             $this->updated_at = $updated_at = datetime();
         } else {
             $this->{$attr} = ${$attr} = ${$attr} === null ? $this->{$attr} : ${$attr};
         }
     }
     $sql->update("attachments", array("id" => $this->id), array("filename" => $filename, "path" => $path, "entity_type" => $entity_type, "entity_id" => $entity_id));
     $trigger->call("update_attachment", $this, $old);
 }
 public function edit($array)
 {
     global $db;
     $tables =& singleton::get(__NAMESPACE__ . '\\tables');
     $error =& singleton::get(__NAMESPACE__ . '\\error');
     $site_id = SITE_ID;
     $last_modified = datetime();
     $query = "UPDATE {$tables->messages} SET site_id = :site_id";
     if (isset($array['from_user_id'])) {
         $query .= ", from_user_id = :from_user_id";
     }
     if (isset($array['subject'])) {
         $query .= ", subject = :subject";
     }
     if (isset($array['message'])) {
         $query .= ", message = :message";
     }
     $query .= ", last_modified = :last_modified";
     $query .= " WHERE id = :id AND site_id = :site_id";
     try {
         $stmt = $db->prepare($query);
     } catch (\PDOException $e) {
         $error->create(array('type' => 'sql_prepare_error', 'message' => $e->getMessage()));
     }
     $stmt->bindParam(':id', $array['id'], database::PARAM_INT);
     $stmt->bindParam(':site_id', $site_id, database::PARAM_INT);
     if (isset($array['from_user_id'])) {
         $stmt->bindParam(':from_user_id', $array['from_user_id'], database::PARAM_INT);
     }
     if (isset($array['subject'])) {
         $stmt->bindParam(':subject', $array['subject'], database::PARAM_STR);
     }
     if (isset($array['message'])) {
         $stmt->bindParam(':message', $array['message'], database::PARAM_STR);
     }
     $stmt->bindParam(':last_modified', $last_modified, database::PARAM_STR);
     try {
         $stmt->execute();
     } catch (\PDOException $e) {
         $error->create(array('type' => 'sql_execute_error', 'message' => $e->getMessage()));
     }
 }
Ejemplo n.º 12
0
	<div class='empty'>
	</div>
	
	<div id='content'>
		<h1 id='header'>Καλώς Ήρθατε στο <strong>|= Ω 2 \_/ ^^</strong> μας!</h1>
		<?php 
if (isset($_COOKIE['userid'])) {
    ?>
<p>Welcome, <?php 
    echo $_COOKIE['username'];
    ?>
 <a href="http://127.0.0.1/forum/logout.php" id="exit">Αποσύνδεση</a></p><?php 
    include '/../models/users.php';
    include '/../models/database.php';
    include '/../models/datetime.php';
    $now = datetime();
    LastActive($_COOKIE['userid'], $now);
} else {
    ?>
<p> Welcome, Guest. Please <a href="http://127.0.0.1/forum/login.php"> Login</a> or  <a href="http://127.0.0.1/forum/register.php" />Register</p><?php 
}
?>
	</div>
	
	<div class='empty'>
	</div>
	
	<div id='navbar'>
		<a href="recenttopics.php">View Recent Topics</a>
		<a href="index.php" >Index Board</a>
	</div>
Ejemplo n.º 13
0
             $display_name_fix = $result['Name'];
             // Insert Name
             $output = str_replace('nameString2', $display_name_fix, $html);
             // Insert Function
             $output = str_replace('functionString', $display_function, $output);
             $output = str_replace('userName', $display_name_str, $output);
             // Insert URL
             $output = str_replace('urlString', $display_url, $output);
             // All
             $output = str_replace('lvlvlv', $lvlvlv, $output);
             $output = str_replace('nextlevel', $nextlevel, $output);
             $output = str_replace('nexttimelv', $nexttimelv, $output);
             if ($result['pDataReg'] != null) {
                 $output = str_replace('datareg', datetime($result['pDataReg']), $output);
             } else {
                 $output = str_replace('datareg', datetime('1/1/2000'), $output);
             }
             $output = str_replace('ponline', $ponline, $output);
             // Output
             //$tpl->set( '{search_name}', implode( "\n", $while ) );
             $tpl_output[] = $output;
         }
     }
 } else {
     $output = str_replace('urlString', 'javascript:void(0);', $html2);
     $output = str_replace('nameString', 'На сервере нет такого пользователя.', $output);
     $output = str_replace('functionString', '0', $output);
     // Format No Results Output
     /*
     $output = str_replace('urlString', 'javascript:void(0);', $html);
     $output = str_replace('nameString', '<b>No Results Found.</b>', $output);
Ejemplo n.º 14
0
 /**
  * Function: update
  * Updates a post with the given attributes.
  *
  * Most of the function arguments will fall back to various POST values.
  *
  * Parameters:
  *     $values - An array of data to set for the post.
  *     $user - <User> to set as the post's author.
  *     $pinned - Pin the post?
  *     $status - Post status
  *     $clean - A new clean URL for the post.
  *     $url - A new URL for the post.
  *     $created_at - New @created_at@ timestamp for the post.
  *     $updated_at - New @updated_at@ timestamp for the post, or @false@ to not updated it.
  *     $options - Options for the post.
  *
  * See Also:
  *     <add>
  */
 public function update($values = null, $user = null, $pinned = null, $status = null, $clean = null, $url = null, $created_at = null, $updated_at = null, $options = null)
 {
     if ($this->no_results) {
         return false;
     }
     $trigger = Trigger::current();
     $user_id = $user instanceof User ? $user->id : $user;
     fallback($values, array_combine($this->attribute_names, $this->attribute_values));
     fallback($user_id, oneof(@$_POST['user_id'], $this->user_id));
     fallback($pinned, (int) (!empty($_POST['pinned'])));
     fallback($status, isset($_POST['draft']) ? "draft" : oneof(@$_POST['status'], $this->status));
     fallback($clean, $this->clean);
     fallback($url, oneof(@$_POST['slug'], $this->feather . "." . $this->id));
     fallback($created_at, !empty($_POST['created_at']) ? datetime($_POST['created_at']) : $this->created_at);
     fallback($updated_at, $updated_at === false ? $this->updated_at : oneof($updated_at, @$_POST['updated_at'], datetime()));
     fallback($options, oneof(@$_POST['option'], array()));
     if ($url != $this->url) {
         # If they edited the slug, the clean URL should change too.
         $clean = $url;
     }
     $old = clone $this;
     # Update all values of this post.
     foreach (array("user_id", "pinned", "status", "url", "created_at", "updated_at") as $attr) {
         $this->{$attr} = ${$attr};
     }
     $new_values = array("pinned" => $pinned, "status" => $status, "clean" => $clean, "url" => $url, "created_at" => $created_at, "updated_at" => $updated_at);
     $trigger->filter($new_values, "before_update_post");
     $sql = SQL::current();
     $sql->update("posts", array("id" => $this->id), $new_values);
     # Insert the post attributes.
     foreach (array_merge($values, $options) as $name => $value) {
         if ($sql->count("post_attributes", array("post_id" => $this->id, "name" => $name))) {
             $sql->update("post_attributes", array("post_id" => $this->id, "name" => $name), array("value" => $this->{$name} = $value));
         } else {
             $sql->insert("post_attributes", array("post_id" => $this->id, "name" => $name, "value" => $this->{$name} = $value));
         }
     }
     $trigger->call("update_post", $this, $old, $options);
 }
Ejemplo n.º 15
0
            $sql->replace("permissions", array("id", "group_id"), array("id" => $id, "name" => $name, "group_id" => 0));
        }
        $groups = array("admin" => array_keys($names), "member" => array("view_site"), "friend" => array("view_site", "view_private", "view_scheduled"), "banned" => array(), "guest" => array("view_site"));
        # Insert the default groups (see above)
        $group_id = array();
        foreach ($groups as $name => $permissions) {
            $sql->replace("groups", "name", array("name" => ucfirst($name)));
            $group_id[$name] = $sql->latest("groups");
            foreach ($permissions as $permission) {
                $sql->replace("permissions", array("id", "group_id"), array("id" => $permission, "name" => $names[$permission], "group_id" => $group_id[$name]));
            }
        }
        $config->set("default_group", $group_id["member"]);
        $config->set("guest_group", $group_id["guest"]);
        if (!$sql->select("users", "id", array("login" => $_POST['login']))->fetchColumn()) {
            $sql->insert("users", array("login" => $_POST['login'], "password" => User::hashPassword($_POST['password_1']), "email" => $_POST['email'], "website" => $config->url, "group_id" => $group_id["admin"], "approved" => true, "joined_at" => datetime()));
        }
        $installed = true;
    }
}
function value_fallback($index, $fallback = "")
{
    echo isset($_POST[$index]) ? fix($_POST[$index]) : $fallback;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
        <title>Chyrp Installer</title>
Ejemplo n.º 16
0
	                </thead>
	
	                <tbody id="tbody_content">
                    <?php 
if ($lc_list) {
    ?>
                      <?php 
    foreach ($lc_list as $item) {
        ?>
                      <tr>
                        <td><?php 
        echo $item->loginname;
        ?>
</td>
                        <td><?php 
        echo datetime($item->logintime);
        ?>
 </td>
                        <td><?php 
        echo $item->loginip;
        ?>
</td>
                        <td><?php 
        if ($item->status == 1) {
            ?>
成功<?php 
        } else {
            ?>
密码错误<?php 
        }
        ?>
Ejemplo n.º 17
0
Archivo: wordpress.php Proyecto: scy/qb
make_dir($dir . '/meta');
$res = query("SELECT id, post_date, post_content, post_title, post_name, " . "post_modified FROM " . $table_prefix . "posts WHERE post_type='post';");
chdir($dir) or die("Could not change into directory '{$dir}'.\n");
echo "Exporting to '{$dir}' with suffix {$suf} and meta-suffix {$muf}...\n";
while (($r = mysql_fetch_assoc($res)) !== false) {
    echo $r['id'] . ': "' . $r['post_title'] . '"... ';
    $content = $r['post_content'];
    $content = str_replace("\r\n\r\n", "</p>\n<p>", $content);
    $content = str_replace("\r\n", "<br />\n", $content);
    $content = "<p>{$content}</p>\n";
    // The above inserts extra <br /> inside of some tags, fix that
    $content = preg_replace_callback('|<pre>.*</pre>|Uims', 'remove_br', $content);
    $content = preg_replace_callback('|<ul>.*</ul>|Uims', 'remove_br', $content);
    $content = preg_replace_callback('|<ol>.*</ol>|Uims', 'remove_br', $content);
    $text = '<:' . htmlspecialchars($r['post_title']) . '>';
    if (isset($tags[$r['id']])) {
        array_unique($tags[$r['id']]);
        $text .= '<tags:' . implode(' ', $tags[$r['id']]) . '>';
    }
    $text .= "\n";
    $text .= $content;
    $src_name = 'src/' . $r['post_name'] . $suf;
    $meta_name = 'meta/' . $r['post_name'] . $muf;
    file_put_contents($src_name, $text) or die("Could not write to '{$src_name}'\n");
    file_put_contents($meta_name, (int) $r['post_date']) or die("Could not write to '{$meta_name}'\n");
    touch($src_name, datetime($r['post_modified'])) or die("Could not change mod time of '{$src_name}'\n");
    touch($meta_name, datetime($r['post_date'])) or die("Could not change mod time of '{$src_name}'\n");
    echo "done.\n";
}
echo "Export finished\n";
echo "\nPlease note: Links for downloads, you own blog entries and images\n" . "still point at your old blog!\n";
Ejemplo n.º 18
0
 function create()
 {
     $this->data = array('id' => '', 'active' => '0', 'start' => datetime(), 'end' => datetime(strtotime('+1 week')), 'author' => $_SESSION['userid'], 'author_first_name' => $_SESSION['first_name'], 'author_last_name' => $_SESSION['last_name'], 'topic' => '', 'text' => '');
 }
Ejemplo n.º 19
0
Archivo: Admin.php Proyecto: eadz/chyrp
 /**
  * Function: import_movabletype
  * MovableType importing.
  */
 public function import_movabletype()
 {
     if (empty($_POST)) {
         redirect("/admin/?action=import");
     }
     if (!Visitor::current()->group->can("add_post")) {
         show_403(__("Access Denied"), __("You do not have sufficient privileges to import content."));
     }
     $config = Config::current();
     $trigger = Trigger::current();
     $dbcon = $dbsel = false;
     if ($link = @mysql_connect($_POST['host'], $_POST['username'], $_POST['password'])) {
         $dbcon = true;
         $dbsel = @mysql_select_db($_POST['database'], $link);
     }
     if (!$dbcon or !$dbsel) {
         Flash::warning(__("Could not connect to the specified MovableType database."), "/admin/?action=import");
     }
     mysql_query("SET NAMES 'utf8'");
     $get_authors = mysql_query("SELECT * FROM mt_author ORDER BY author_id ASC", $link) or error(__("Database Error"), mysql_error());
     $users = array();
     while ($author = mysql_fetch_array($get_authors)) {
         # Try to figure out if this author is the same as the person doing the import.
         if ($author["author_name"] == Visitor::current()->login or $author["author_nickname"] == Visitor::current()->login or $author["author_nickname"] == Visitor::current()->full_name or $author["author_url"] == Visitor::current()->website or $author["author_email"] == Visitor::current()->email) {
             $users[$author["author_id"]] = Visitor::current();
         } else {
             $users[$author["author_id"]] = User::add($author["author_name"], $author["author_password"], $author["author_email"], $author["author_nickname"] != $author["author_name"] ? $author["author_nickname"] : "", $author["author_url"], $author["author_can_create_blog"] == "1" ? Visitor::current()->group : null, $author["author_created_on"], false);
         }
     }
     $get_posts = mysql_query("SELECT * FROM mt_entry ORDER BY entry_id ASC", $link) or error(__("Database Error"), mysql_error());
     $posts = array();
     while ($post = mysql_fetch_array($get_posts)) {
         $posts[$post["entry_id"]] = $post;
     }
     foreach ($posts as $post) {
         $body = $post["entry_text"];
         if (!empty($post["entry_text_more"])) {
             $body .= "\n\n<!--more-->\n\n" . $post["entry_text_more"];
         }
         $regexp_url = preg_quote($_POST['media_url'], "/");
         if (!empty($_POST['media_url']) and preg_match_all("/{$regexp_url}([^\\.\\!,\\?;\"\\'<>\\(\\)\\[\\]\\{\\}\\s\t ]+)\\.([a-zA-Z0-9]+)/", $body, $media)) {
             foreach ($media[0] as $matched_url) {
                 $filename = upload_from_url($matched_url);
                 $body = str_replace($matched_url, $config->url . $config->uploads_path . $filename, $body);
             }
         }
         $status_translate = array(1 => "draft", 2 => "public", 3 => "draft", 4 => "draft");
         $clean = oneof($post["entry_basename"], sanitize($post["entry_title"]));
         if (empty($post["entry_class"]) or $post["entry_class"] == "entry") {
             $new_post = Post::add(array("title" => $post["entry_title"], "body" => $body, "imported_from" => "movabletype"), $clean, Post::check_url($clean), "text", @$users[$post["entry_author_id"]], false, $status_translate[$post["entry_status"]], oneof(@$post["entry_authored_on"], @$post["entry_created_on"], datetime()), $post["entry_modified_on"], "", false);
             $trigger->call("import_movabletype_post", $post, $new_post, $link);
         } elseif (@$post["entry_class"] == "page") {
             $new_page = Page::add($post["entry_title"], $body, null, 0, true, 0, $clean, Page::check_url($clean));
             $trigger->call("import_movabletype_page", $post, $new_page, $link);
         }
     }
     mysql_close($link);
     Flash::notice(__("MovableType content successfully imported!"), "/admin/?action=import");
 }
Ejemplo n.º 20
0
 public function admin_update_milestone($admin)
 {
     if (!isset($_POST['milestone_id'])) {
         error(__("Error"), __("No milestone ID specified.", "progress"));
     }
     if (!isset($_POST['hash']) or $_POST['hash'] != Config::current()->secure_hashkey) {
         show_403(__("Access Denied"), __("Invalid security key."));
     }
     $milestone = new Milestone($_POST['milestone_id']);
     if ($milestone->no_results) {
         error(__("Error"), __("Invalid milestone ID specified.", "progress"));
     }
     if (!$milestone->editable()) {
         show_403(__("Access Denied"), __("You do not have sufficient privileges to edit this milestone.", "progress"));
     }
     $due = empty($_POST['due']) ? "0000-00-00 00:00:00" : datetime($_POST['due']);
     $milestone->update($_POST['name'], $_POST['description'], $due);
     Flash::notice(__("Milestone updated.", "progress"), "/admin/?action=manage_milestones");
 }
Ejemplo n.º 21
0
<table class="toolbar" align="right">
<tr>
<td align="center"><a class="toolbar" href="https://www.benfund.com/acct/new_invoice.php"><img src="https://www.benfund.com/images/elements/icons/new-invoice.png" border="0"/><br />New Invoice</a></td>
<td align="center"><a class="toolbar" href="https://www.benfund.com/acct/invoices.php"><img src="https://www.benfund.com/images/elements/icons/invoice.png" border="0"/><br />Invoice Batch</a></td>
</tr></table>
</td></tr></table>

<?php 
if ($_GET['cmd'] == 'new') {
    if (!$niinvnum) {
        $niinvnum = rand(01, 9999);
    } else {
        $niinvnum = $_POST['invnum'];
    }
    $niclient = $_POST['client'];
    $nidate = datetime();
    $nithetotal = $_POST['thetotal'];
    $nigrandtotal = $_POST['grandtotal'];
    $nitotalshipping = $_POST['shippingtotal'];
    $nitotaltax = $_POST['totaltax'];
    $ninotes = $_POST['notes'];
    $niterms = $_POST['terms'];
    $nisubtotal = $_POST['subtotal'];
    $niaddtax = $_POST['addtax'];
    $niaddship = $_POST['addship'];
    $print = $_POST['print'];
    $send = $_POST['send'];
    benfund_connect();
    $newiq = "01 INTO invoice (inv, to_id, from_id, date, desc, total, shipping, tax, notes, terms) VALUES('{$niinvnum}', '{$niclient}', '{$mid}', '{$nidate}', '{$nithetotal}', '{$nigrandtotal}', '{$nitotalshipping}', '{$nitotaltax}', '{$ninotes}', '{$niterms}')";
    echo $newiq;
    mysql_query($newiq) or die(mysql_error());
Ejemplo n.º 22
0
 /**
  * Function: index
  * Grabs the posts for the main page.
  */
 public function index()
 {
     $sql = SQL::current();
     $posts = $sql->select("posts", "posts.id", array("posts.created_at <=" => datetime(), "posts.status" => "scheduled"))->fetchAll();
     if (!empty($posts)) {
         foreach ($posts as $post) {
             $sql->update("posts", array("id" => $post), array("status" => "public"));
         }
     }
     $this->display("pages/index", array("posts" => new Paginator(Post::find(array("placeholders" => true)), $this->post_limit)));
 }
Ejemplo n.º 23
0
</table>
<table class="tablesorter" id="invmanrec" align="center" border="0" cellpadding="4" cellspacing="0" width="95%">
<thead>
<tr>
<th valign="top" width="50" ><a href="#"><b>Inv#</b></a></th>
<th valign="top" width="400" ><a href="#"><b>Client</b></a></th>
<th valign="top" width="40" ><a href="#"><b>Amount</b></a></th>
<th valign="top" width="50" ><a href="#"><b>Date</b></a></th>
<th valign="top" width="30" ><a href="#"><b>Status</b></a></th>
</tr>
</thead>
<tbody>
<?php 
benfund_connect();
$back = future_past("-", 720);
$front = datetime();
$query = "SELECT * FROM invoice WHERE from_id='{$mid}' ORDER BY id DESC";
//$query = "SELECT * FROM invoice WHERE date BETWEEN $back AND $front AND from_id='$mid' ORDER BY id DESC";
$result = mysql_query($query);
$color1 = "row0";
$color2 = "row1";
$row_count = 0;
while ($row = mysql_fetch_array($result)) {
    if ($result) {
        $id = $row[0];
        $inv = $row[1];
        $to = $row[2];
        $total = $row['total'];
        $status = $row['status'];
        if ($status == 0) {
            $condition = '<span class="true">Paid</span>';
$rank = $user->data()->GroupNo;
if (!$user->isLoggedIn() && $rank == 3) {
    Redirect::to('login.php');
}
Session::put('CPage', 'Database.php');
$options = getNavBar($rank);
if (Input::exists()) {
    if (Token::check(Input::get('token'))) {
        $displayerror = '';
        $validate = new Validate();
        $validation = $validate->check($_POST, array('ID' => array('required' => true, 'numbered' => true, 'unique' => 'users', 'max' => 10, 'min' => 10), 'Course' => array(), 'school' => array(), 'Room_ID' => array(), 'Position' => array(), 'Name' => array(), 'Password' => array('required' => true, 'min' => 6), 'reenterPassword' => array('required' => true, 'matches' => 'Password'), 'house_no' => array('required' => true), 'area' => array('required' => true), 'postcode' => array('required' => true, 'max' => 5), 'State' => array('required' => true), 'IC' => array('required' => true, 'numbered' => true), 'gender' => array('required' => true), 'race' => array('required' => true), 'religion' => array('required' => true), 'EMail' => array('required' => true, 'email form' => true), 'telephone' => array('required' => true, 'numbered' => true)));
        if ($validation->passed()) {
            $user = new User();
            $salt = Hash::salt(32);
            try {
                $user->create(array('Name' => Input::get('Name'), 'ID' => Input::get('ID'), 'Password' => Hash::make(Input::get('Password'), $salt), 'salt' => $salt, 'IC' => Input::get('IC'), 'TelephoneNo' => Input::get('telephone'), 'Email' => Input::get('EMail'), 'Gender' => Input::get('gender'), 'Race' => Input::get('race'), 'Religion' => Input::get('religion'), 'House_No' => Input::get('house_no'), 'Area' => Input::get('area'), 'Postcode' => Input::get('postcode'), 'State' => Input::get('State'), 'RegDateTime' => datetime(), 'RoomID' => Input::get('Room_ID'), 'GroupNo' => Input::get('Position')));
                Session::flash('home', 'Registration successful, Please login');
                Redirect::to('login.php');
            } catch (Exception $e) {
                die($e->getMessage());
            }
        } else {
            foreach ($validation->errors() as $error) {
                $displayerror .= $error . '<br>';
            }
            Session::flash('error', $displayerror);
        }
    }
}
?>
<!DOCTYPE html> 
 private function increment_failed_login($user)
 {
     global $db;
     $users =& singleton::get(__NAMESPACE__ . '\\users');
     $users->edit(array('id' => $user['id'], 'failed_logins' => $user['failed_logins'] + 1, 'fail_expires' => datetime(900)));
     return true;
 }
Ejemplo n.º 26
0
        $names = array("change_settings" => "Change Settings", "toggle_extensions" => "Toggle Extensions", "view_site" => "View Site", "view_private" => "View Private Posts", "view_draft" => "View Drafts", "view_own_draft" => "View Own Drafts", "add_post" => "Add Posts", "add_draft" => "Add Drafts", "edit_post" => "Edit Posts", "edit_draft" => "Edit Drafts", "edit_own_post" => "Edit Own Posts", "edit_own_draft" => "Edit Own Drafts", "delete_post" => "Delete Posts", "delete_draft" => "Delete Drafts", "delete_own_post" => "Delete Own Posts", "delete_own_draft" => "Delete Own Drafts", "add_page" => "Add Pages", "edit_page" => "Edit Pages", "delete_page" => "Delete Pages", "add_user" => "Add Users", "edit_user" => "Edit Users", "delete_user" => "Delete Users", "add_group" => "Add Groups", "edit_group" => "Edit Groups", "delete_group" => "Delete Groups");
        foreach ($names as $id => $name) {
            $sql->replace("permissions", array("id", "group_id"), array("id" => $id, "name" => $name, "group_id" => 0));
        }
        $groups = array("admin" => array_keys($names), "member" => array("view_site"), "friend" => array("view_site", "view_private"), "banned" => array(), "guest" => array("view_site"));
        # Insert the default groups (see above)
        $group_id = array();
        foreach ($groups as $name => $permissions) {
            $sql->replace("groups", "name", array("name" => ucfirst($name)));
            $group_id[$name] = $sql->latest("groups");
            foreach ($permissions as $permission) {
                $sql->replace("permissions", array("id", "group_id"), array("id" => $permission, "name" => $names[$permission], "group_id" => $group_id[$name]));
            }
        }
        $config->set("default_group", $group_id["member"]);
        $config->set("guest_group", $group_id["guest"]);
        if (!$sql->select("users", "id", array("login" => $settings['login']))->fetchColumn()) {
            $sql->insert("users", array("login" => $settings['login'], "password" => User::hashPassword($settings['password_1']), "email" => $settings['email'], "website" => $config->url, "group_id" => $group_id["admin"], "joined_at" => datetime()));
        }
        $sql->insert("posts", array("feather" => "text", "clean" => "welcome", "url" => "welcome", "pinned" => 0, "status" => "public", "user_id" => 1, "created_at" => datetime(), "updated_at" => NULL));
        $sql->insert("post_attributes", array("post_id" => 1, "name" => "title", "value" => "Welcome!"));
        $sql->insert("post_attributes", array("post_id" => 1, "name" => "body", "value" => "Welcome to your own personal, temporary Chyrp demo! This installation will be deleted after 30 minutes. To begin, log in with the username \"Admin\" and the password \"admin\".\n\nHave fun!\n\nP.S. Don't forget to enable some modules and feathers."));
        $installed = true;
    }
}
if ($installed) {
    header("Location: http://chyrp.net/demos/" . $num);
} else {
    echo "Sorry, for some reason the demo could not be created.\n";
    var_dump($errors);
}
Ejemplo n.º 27
0
 public function lists($page = 1)
 {
     $map = array();
     $list_row = I('r', 10);
     $postModel = D('Post');
     //tag搜索
     $tags = I('get.tag');
     if ($tags) {
         $ids = $postModel->where("FIND_IN_SET('{$tags}',tags)")->getField('id', true);
         $this->assign('title', "标签 <i>{$tags}</i> 下的文章");
         if (!empty($ids)) {
             $map['id'] = array('in', $ids);
         }
     }
     //关键词搜搜
     if (I('get.kw')) {
         $kw = trim(I('get.kw'));
         $search = array();
         $search['title'] = array('like', '%{$kw}%');
         $like_id = $postModel->where("content LIKE '%{$kw}%' OR description LIKE '%{$kw}%'")->getField('id', true);
         if ($like_id) {
             $search['id'] = array('in', $like_id);
         }
         $search['_logic'] = 'or';
         $map['_complex'] = $search;
     }
     //区分所有人和本人发布的文章
     if (false !== strpos(__SELF__, 'mine') && is_login()) {
         $map['member_id'] = session('user.uid');
     }
     //归档搜索
     if (isset($_GET['year']) && isset($_GET['month'])) {
         $year = CONTROLLER_NAME;
         $month = ACTION_NAME;
         $map['_string'] = "`deadline` LIKE binary('{$year}-{$month}%')";
     }
     $map['deadline'] = array('elt', datetime());
     $this->assign('list', $postModel->where($map)->page($page, $list_row)->order('`deadline` DESC')->select());
     /* 分页 */
     $total = $postModel->where($map)->count();
     $page = new \Think\Page($total, $list_row);
     $page->setConfig('prev', '上一页');
     $page->setConfig('next', '下一页');
     $page->setConfig('theme', '<div class="pager">%UP_PAGE% %DOWN_PAGE%</div>');
     $p = $page->show();
     $this->assign('_page', $p ? $p : '');
     //tag列表
     $this->assign('tags', M('Tags')->order('count DESC')->select());
     //获取归档
     $list = $postModel->where($map)->order('`deadline` DESC,`id` DESC')->select();
     $date = $time = array();
     foreach ($list as $key => $value) {
         if ($value['deadline']) {
             $time[] = date('F Y', strtotime($value['deadline']));
         }
     }
     $time = array_unique($time);
     foreach ($time as $key => $value) {
         $date[] = array('text' => $value, 'link' => date('Y/m', strtotime($value)));
     }
     $this->assign('archive', $date);
 }
Ejemplo n.º 28
0
 public function metaWeblog_newPost($args)
 {
     $this->auth($args[1], $args[2], 'add');
     global $user;
     # Support for extended body
     $body = $args[3]['description'];
     if (!empty($args[3]['mt_text_more'])) {
         $body .= '<!--more-->' . $args[3]['mt_text_more'];
     }
     # Add excerpt to body so it isn't lost
     if (!empty($args[3]['mt_excerpt'])) {
         $body = $args[3]['mt_excerpt'] . "\n\n" . $body;
     }
     if (trim($body) === '') {
         return new IXR_Error(500, __("Body can't be blank."));
     }
     $clean = sanitize(oneof(@$args[3]['mt_basename'], $args[3]['title']));
     $url = Post::check_url($clean);
     $_POST['user_id'] = $user->id;
     $_POST['feather'] = XML_RPC_FEATHER;
     $_POST['created_at'] = oneof($this->convertFromDateCreated($args[3]), datetime());
     if ($user->group->can('add_post')) {
         $_POST['status'] = $args[4] ? 'public' : 'draft';
     } else {
         $_POST['status'] = 'draft';
     }
     $trigger = Trigger::current();
     $trigger->call('metaWeblog_newPost_preQuery', $args[3]);
     $post = Post::add(array('title' => $args[3]['title'], 'body' => $body), $clean, $url);
     if ($post->no_results) {
         return new IXR_Error(500, __("Post not found."));
     }
     $trigger->call('metaWeblog_newPost', $args[3], $post);
     # Send any and all pingbacks to URLs in the body
     if (Config::current()->send_pingbacks) {
         send_pingbacks($args[3]['description'], $post);
     }
     return $post->id;
 }
Ejemplo n.º 29
0
$onlinedb_count = $db->query("SELECT count(*) FROM accounts WHERE pLogin='******'") or die(mysql_error());
$tpl->load_template('online.tpl');
if (!$inum) {
    $tpl->set('{numonline}', "0");
} else {
    $tpl->set('{numonline}', $inum);
}
$tpl->set('{THEME}', THEME);
if ($row = mysql_fetch_row($onlinedb_count)) {
    $total_rows = $row[0];
    $num_pages = ceil($total_rows / $per_page);
    for ($i = 1; $i <= $num_pages; $i++) {
        $idnumber = $i;
    }
}
//echo gets( isset($_GET['page']) ? (int)$_GET['page'] : 1 , 100, '/test/inc.php?page=');
$menu = gets(isset($_GET['page']) ? (int) $_GET['page'] : $page, $idnumber, '/users/online/page/');
$tpl->set('{page}', $menu);
while ($rowonline = mysql_fetch_array($onlinedb)) {
    $nextlevel = $rowonline['pLevel'] + 1;
    $expamount = $nextlevel * 4;
    $nexttimelv = $expamount - $rowonline['pExp'];
    $while[] = '<tr><td align="center" width="20" class="table_num"></td><td align="center" width="30"><a href="/skin/zoom/' . $rowonline['Name'] . '.png" class="zoom"><img src="/skin/' . $rowonline['Name'] . '.png" width="30" border="0" /></a></td><td><a href="javascript://" rel="nofollow" onclick="window.open(\'/profile/' . $rowonline['Name'] . '/\',\'up1\',\'scrollbars=1,top=0,left=0,resizable=1,width=780,height=310\');return false;">' . str_replace('_', ' ', $rowonline['Name']) . '</a> <font color="#5e5e5e" size="-2"> или ' . $rowonline['Name'] . '</font></td><td align="left" width="85"><font color="#5e5e5e" size="-1">Уровень: <font color="#006600"><b>' . $rowonline['pLevel'] . '</b></font></font></td> <td align="left" width="155" ><font color="#5e5e5e" size="-2">до <font color="#9D0000"><b>' . $nextlevel . '</b></font> уровня осталось: <font color="#9D0000"><b>' . $nexttimelv . '</b></font> ч</font></td><td align="center"><font color="#5e5e5e" size="-1">' . datetime($rowonline['pDataReg']) . '</font></td><td align="center" class="mps">' . str_replace(':', 'ч, ', $rowonline['pOnlineLid']) . 'мин.</td></tr>';
}
if (!$while) {
    $tpl->set('{online}', '<tr><td colspan="7" align="center">' . $lang_error['err_01.no_user'] . '</td></tr>');
} else {
    $tpl->set('{online}', implode("\n", $while));
}
$tpl->compile('usersonline');
eval(' ?' . '>' . $tpl->result['usersonline'] . '<' . '?php ');
Ejemplo n.º 30
0
 public function cscms_skins($field, $str, $label, $row, $sorti = 1, $autoarr = array())
 {
     preg_match_all('/\\[' . $field . ':\\s*([0-9a-zA-Z\\_\\-]+)([\\s]*[link|ulink|dir|level|zd|len|style]*)[=]??([\\d0-9a-zA-Z\\,\\{\\}\\/\\-\\\\:\\s]*)\\]/', $str, $field_arr);
     if (!empty($field_arr)) {
         //判断是否嵌套二级
         preg_match('/{cscmstype:([\\S]+)\\s+(.*?)}([\\s\\S]+?){\\/cscmstype:\\1}/', $label, $type_arr);
         if (!empty($type_arr)) {
             $label = $this->cscms_sql_to($type_arr[1], $type_arr[2], $type_arr[0], $type_arr[3], $label, $row['id']);
         }
         unset($type_arr);
         for ($i = 0; $i < count($field_arr[0]); $i++) {
             $type = $field_arr[1][$i];
             if (array_key_exists($type, $row) && trim($field_arr[2][$i]) != 'zd') {
                 if ($type == 'addtime') {
                     $label = str_replace('[' . $field . ':' . $type . ']', date('Y-m-d H:i:s', $row[$type]), $label);
                 } else {
                     $label = str_replace('[' . $field . ':' . $type . ']', $row[$type], $label);
                 }
                 //判断自定义标签
                 if (!empty($field_arr[2][$i]) && !empty($field_arr[3][$i])) {
                     //格式化时间
                     if (trim($field_arr[2][$i]) == 'style' && trim($field_arr[3][$i]) == 'time') {
                         $label = str_replace($field_arr[0][$i], datetime($row[$type]), $label);
                         //获取IP地区
                     } elseif (trim($field_arr[2][$i]) == 'style' && trim($field_arr[3][$i]) == 'city') {
                         $ci =& get_instance();
                         $ci->load->library('ip');
                         $label = str_replace($field_arr[0][$i], $ci->ip->address($row[$type]), $label);
                         //自定义时间
                     } elseif (trim($field_arr[2][$i]) == 'style') {
                         $label = str_replace($field_arr[0][$i], date(str_replace('f', 'i', $field_arr[3][$i]), $row[$type]), $label);
                         //图片地址
                     } elseif (trim($field_arr[2][$i]) == 'dir') {
                         $lall = explode(",", $field_arr[3][$i]);
                         $lass = count($lall) > 1 ? $lall[1] : '';
                         $pic = piclink($lall[0], $row[$type], $lass);
                         $label = str_replace($field_arr[0][$i], $pic, $label);
                     }
                     //字符截取
                     if (trim($field_arr[2][$i]) == 'len') {
                         $label = str_replace($field_arr[0][$i], sub_str(str_checkhtml($row[$type]), $field_arr[3][$i]), $label);
                     }
                 }
             } else {
                 //外部字段
                 switch ($type) {
                     //序
                     case 'i':
                         $label = str_replace($field_arr[0][$i], $sorti, $label);
                         break;
                         //序
                     //序
                     case 'addres':
                         if (trim($field_arr[2][$i]) == 'zd' && !empty($field_arr[3][$i]) && array_key_exists($field_arr[3][$i], $row)) {
                             $zd = $field_arr[3][$i];
                             $ci =& get_instance();
                             $ci->load->library('ip');
                             $label = str_replace($field_arr[0][$i], $ci->ip->address($row[$zd]), $label);
                         }
                         break;
                         //数据统计
                     //数据统计
                     case 'count':
                         if (trim($field_arr[2][$i]) == 'zdy' && !empty($field_arr[3][$i])) {
                             $count = 0;
                             $arr = explode(',', $field_arr[3][$i]);
                             $table = $arr[0];
                             $czd = empty($arr[1]) ? 'id' : $arr[1];
                             $szd = empty($arr[2]) ? 'id' : $arr[2];
                             if (array_key_exists($szd, $row)) {
                                 $ci =& get_instance();
                                 if (!isset($ci->db)) {
                                     $ci->load->database();
                                 }
                                 $uid = !empty($row[$szd]) ? $row[$szd] : (!empty($row['uid']) ? $row['uid'] : 0);
                                 if (!empty($table) && $ci->db->table_exists(CS_SqlPrefix . $table) && $ci->db->field_exists($czd, CS_SqlPrefix . $table)) {
                                     if (!empty($arr[3]) && (!empty($arr[4]) || (int) $arr[4] == 0)) {
                                         if ($ci->db->field_exists($arr[3], CS_SqlPrefix . $table)) {
                                             $count = $ci->db->query("SELECT id FROM " . CS_SqlPrefix . $table . " where " . $czd . "='" . $uid . "' and " . $arr[3] . "='" . $arr[4] . "'")->num_rows();
                                         }
                                     } else {
                                         $count = $ci->db->query("SELECT id FROM " . CS_SqlPrefix . $table . " where " . $czd . "='" . $uid . "'")->num_rows();
                                     }
                                 }
                             }
                             $label = str_replace($field_arr[0][$i], $count, $label);
                         }
                         break;
                         //会员信息
                     //会员信息
                     case 'user':
                         if (($field == 'user' or array_key_exists('uid', $row) or array_key_exists('uidb', $row)) && trim($field_arr[2][$i]) == 'zd' && !empty($field_arr[3][$i])) {
                             $ci =& get_instance();
                             if (!isset($ci->db)) {
                                 $ci->load->database();
                             }
                             $ziduan = $field_arr[3][$i];
                             $zdneir = ($field == 'gbook' or $field == 'pl') ? '游客' : 'null';
                             if ($field == 'user') {
                                 $uid = $row['id'];
                             } else {
                                 $lall = explode(",", $ziduan);
                                 if (!empty($lall[1])) {
                                     $uid = !empty($lall[1]) ? $lall[1] : 0;
                                     $ziduan = $lall[1];
                                 } else {
                                     if (!empty($row['uid'])) {
                                         $uid = $row['uid'];
                                     } else {
                                         $uid = !empty($row['uidb']) ? $row['uidb'] : 0;
                                     }
                                 }
                             }
                             $czd = $ziduan == 'nichen' ? $ziduan . ',name' : $ziduan;
                             if ($ci->db->field_exists($ziduan, CS_SqlPrefix . 'user')) {
                                 $rowu = $ci->db->query("SELECT " . $czd . " FROM " . CS_SqlPrefix . "user where id='" . $uid . "'")->row();
                                 if ($rowu) {
                                     $zdneir = $field_arr[3][$i] == 'nichen' && empty($rowu->{$ziduan}) ? $rowu->name : $rowu->{$ziduan};
                                 }
                             }
                             if ($ziduan == 'logo') {
                                 if ($uid == 0) {
                                     $zdneir = '';
                                 }
                                 $zdneir = piclink('logo', $zdneir);
                             }
                             if ($ziduan == 'zid') {
                                 if ($zdneir == 0) {
                                     $zdneir = 1;
                                 }
                                 $zdneir = getzd('userzu', 'name', $zdneir);
                             }
                             if ($ziduan == 'qianm') {
                                 if (empty($zdneir)) {
                                     $zdneir = '暂时没有签名...';
                                 }
                             }
                             if ($ziduan == 'city') {
                                 if (empty($zdneir)) {
                                     $zdneir = '保密';
                                 }
                             }
                             $label = str_replace($field_arr[0][$i], $zdneir, $label);
                             //会员等级
                         } elseif (($field == 'user' or array_key_exists('uid', $row) or array_key_exists('uidb', $row)) && trim($field_arr[2][$i]) == 'level' && !empty($field_arr[3][$i])) {
                             $zdneir = '';
                             if ($field == 'user') {
                                 $uid = $row['id'];
                             } else {
                                 $uid = !empty($row['uid']) ? $row['uid'] : (!empty($row['uidb']) ? $row['uidb'] : 0);
                             }
                             $jinyan = getzd('user', 'jinyan', $uid);
                             if ($field_arr[3][$i] == '1') {
                                 //星星数
                                 $zdneir = getlevel($jinyan, 1);
                             }
                             if ($field_arr[3][$i] == '2') {
                                 //下个级别需要经验
                                 $zdneir = getlevel($jinyan, 2);
                             }
                             if ($field_arr[3][$i] == '3') {
                                 //下个级别剩余经验
                                 $zdneir = getlevel($jinyan, 3);
                             }
                             if ($field_arr[3][$i] == '4') {
                                 //剩余百分比
                                 $zdneir = getlevel($jinyan, 4);
                             }
                             if ($field_arr[3][$i] == '5') {
                                 //名称
                                 $zdneir = getlevel($jinyan, 5);
                             }
                             $label = str_replace($field_arr[0][$i], $zdneir, $label);
                         }
                         break;
                         //歌手信息
                     //歌手信息
                     case 'singer':
                         if (array_key_exists('singerid', $row) && trim($field_arr[2][$i]) == 'zd' && !empty($field_arr[3][$i])) {
                             $ci =& get_instance();
                             if (!isset($ci->db)) {
                                 $ci->load->database();
                             }
                             $zdneir = 'null';
                             if ($ci->db->table_exists(CS_SqlPrefix . 'singer')) {
                                 //歌手表存在
                                 $ziduan = $field_arr[3][$i];
                                 if ($ci->db->field_exists($ziduan, CS_SqlPrefix . 'singer')) {
                                     $rows = $ci->db->query("SELECT " . $ziduan . " FROM " . CS_SqlPrefix . "singer where id='" . $row['singerid'] . "'")->row();
                                     if ($rows) {
                                         $zdneir = $rows->{$ziduan};
                                     }
                                 }
                                 if ($ziduan == 'pic') {
                                     if ($row['singerid'] == 0) {
                                         $zdneir = '';
                                     }
                                     $zdneir = piclink('singer', $zdneir);
                                 }
                             }
                             $label = str_replace($field_arr[0][$i], $zdneir, $label);
                         }
                         break;
                         //版块链接
                     //版块链接
                     case 'murl':
                         if (array_key_exists('dir', $row)) {
                             $link = cscmslink($row['dir']);
                             $label = str_replace($field_arr[0][$i], $link, $label);
                         }
                         break;
                         //网站链接
                     //网站链接
                     case 'url':
                         //全局
                         if (array_key_exists('id', $row) && trim($field_arr[2][$i]) == 'link' && !empty($field_arr[3][$i])) {
                             $lall = explode(",", $field_arr[3][$i]);
                             $lass = count($lall) > 1 ? $lall[1] : '';
                             $link = linkurl($lall[0], $lass, $row['id']);
                             $label = str_replace($field_arr[0][$i], $link, $label);
                         }
                         //会员
                         if ((array_key_exists('uid', $row) || array_key_exists('uidb', $row) || $field == 'user') && trim($field_arr[2][$i]) == 'ulink' && !empty($field_arr[3][$i])) {
                             $ci =& get_instance();
                             if (!isset($ci->db)) {
                                 $ci->load->database();
                             }
                             $link = '';
                             if ($field == 'user') {
                                 if (array_key_exists('id', $row) && array_key_exists('name', $row)) {
                                     $lall = explode(",", $field_arr[3][$i]);
                                     $lass = count($lall) > 1 ? $lall[1] : '';
                                     $link = userlink($lall[0], $row['id'], $row['name'], $lass);
                                 }
                             } else {
                                 $uid = !empty($row['uid']) ? $row['uid'] : (!empty($row['uidb']) ? $row['uidb'] : 0);
                                 $rowu = $ci->db->query("SELECT id,name FROM " . CS_SqlPrefix . "user where id='" . $uid . "'")->row();
                                 if (!$rowu) {
                                     $link = 'http://' . Web_Url . Web_Path;
                                 } else {
                                     $lall = explode(",", $field_arr[3][$i]);
                                     $lass = count($lall) > 1 ? $lall[1] : '';
                                     $link = userlink($lall[0], $rowu->id, $rowu->name, $lass);
                                 }
                             }
                             $label = str_replace($field_arr[0][$i], $link, $label);
                         }
                         //会员中心...
                         if (trim($field_arr[2][$i]) == 'userlink' && !empty($field_arr[3][$i])) {
                             $link = spacelink($field_arr[3][$i]);
                             $label = str_replace($field_arr[0][$i], $link, $label);
                         }
                         //自定义URL,板块,字段,参数,参数...
                         if (trim($field_arr[2][$i]) == 'zdy' && !empty($field_arr[3][$i])) {
                             $lall = explode(",", $field_arr[3][$i]);
                             if (!array_key_exists($lall[1], $row) || $row[$lall[1]] == 0) {
                                 $link = 'http://' . Web_Url . Web_Path;
                             } else {
                                 $lass = count($lall) > 3 ? $lall[3] : '';
                                 $link = linkurl($lall[2], $lass, $row[$lall[1]], 1, $lall[0]);
                             }
                             $label = str_replace($field_arr[0][$i], $link, $label);
                         }
                         break;
                 }
             }
         }
     }
     unset($field_arr);
     return $label;
 }