예제 #1
0
    $user_id = $user_session['user_id'];
}
if (getSuccessClientTopup($user_id)) {
    foreach (getSuccessClientTopup($user_id)->result() as $value) {
        ?>
                                <li class="list-group-item">
                                    <span class="media-left media-icon">
                                        <span class="round-icon sm bg-success"><i class="fa fa-paper-plane"></i></span>
                                    </span>
                                    <div class="media-body">
                                        <span class="block"><?php 
        echo $value->trans_amount . " Top Up Success";
        ?>
</span>
                                        <span class="text-muted"><?php 
        echo mysqldatetime_to_timestamp($value->trans_request_date);
        ?>
</span>
                                    </div>
                                </li>
                             <?php 
    }
} else {
    ?>
    
                                <li class="list-group-item">
                                    <a href="javascript:;" class="media">
                                        <span class="media-left media-icon">
                                            <span class="round-icon sm bg-success"><i class="fa fa-paper-plane"></i></span>
                                        </span>
                                        <div class="media-body">
예제 #2
0
                	<ul class="list-group">
                        <?php 
if (getAdminTopup($user_id)) {
    foreach (getAdminTopup($user_id)->result() as $value) {
        ?>
                                <li class="list-group-item">
                                    <span class="media-left media-icon">
                                        <span class="round-icon sm bg-success"><i class="fa fa-paper-plane"></i></span>
                                    </span>
                                    <div class="media-body">
                                        <span class="block"><?php 
        echo $value->topup_amount . " Top Up Success";
        ?>
</span>
                                        <span class="text-muted"><?php 
        echo mysqldatetime_to_timestamp($value->topup_time);
        ?>
</span>
                                    </div>
                                </li>
                             <?php 
    }
} else {
    ?>
    
                                <li class="list-group-item">
                                    <a href="javascript:;" class="media">
                                        <span class="media-left media-icon">
                                            <span class="round-icon sm bg-success"><i class="fa fa-paper-plane"></i></span>
                                        </span>
                                        <div class="media-body">
예제 #3
0
function mysqldatetime_to_date($datetime = "", $format = "d.m.Y, H:i:s")
{
    return date($format, mysqldatetime_to_timestamp($datetime));
}
예제 #4
0
function getItemsFromFeeds($rs, $print)
{
    global $blog_settings, $core;
    $output = "";
    $cron_file = dirname(__FILE__) . '/cron_running.txt';
    # Duree de mise a jour
    $debut = explode(" ", microtime());
    $debut = $debut[1] + $debut[0];
    $cpt = 0;
    while ($rs->fetch()) {
        # On verifie si on n'a pas demandé l'arrêt de l'algo
        if (file_exists(dirname(__FILE__) . '/STOP')) {
            $log_msg = logMsg(T_("STOP file detected, trying to shut down cron job"), "", 2, $print);
            if ($print) {
                $output .= $log_msg;
            }
            break;
        }
        $log_msg = logMsg(T_("Check feed : ") . $rs->feed_url, "", 0, $print);
        if ($print) {
            $output .= $log_msg;
        }
        require_once dirname(__FILE__) . '/lib/simplepie_1.3.compiled.php';
        # On cree un objet SimplePie et on ajuste les parametres de base
        $feed = new SimplePie();
        $feed->set_feed_url($rs->feed_url);
        $feed->set_cache_location(dirname(__FILE__) . '/../admin/cache');
        #$feed->enable_cache(false);
        #		$feed->set_cache_duration($item_refresh);
        $feed->init();
        # Pour faire fonctionner les lecteurs flash, non recomande par simplepie
        $feed->strip_htmltags(false);
        # Si le flux ne contient pas  de donnee
        #$item_nb = $feed->get_item_quantity();
        $error = $feed->error();
        if (isset($error)) {
            # Affichage du message d'erreur
            if (ereg($rs->feed_url, $error)) {
                $log_msg = logMsg(T_("No feed found : ") . $error, "", 3, $print);
            } else {
                $log_msg = logMsg(sprintf(T_("No feed found on %s (owner : %s)"), $rs->feed_url, $rs->user_id) . $error, "", 3, $print);
            }
            if ($print) {
                $output .= $log_msg;
            }
        } else {
            $items = $feed->get_items();
            foreach ($items as $item) {
                #print $item->get_permalink().'<br>';
                #continue;
                # open log file and write activity down
                $fp = @fopen($cron_file, 'wb');
                if ($fp === false) {
                    throw new Exception(sprintf(T_('Cannot write %s file.'), $cron_file));
                }
                fwrite($fp, time());
                fclose($fp);
                # Analyse the item
                #####################
                # Content
                $item_content = strip_script($item->get_content());
                if (empty($item_content)) {
                    $item_content = $item->get_description();
                }
                $item_content = traitementEncodage($item_content);
                # Title
                $item_title = traitementEncodage($item->get_title());
                if (strlen($item_title) > 254) {
                    $item_title = substr($item_title, 0, 254);
                }
                # Permalink
                $permalink = $item->get_permalink();
                $item_image = getFirstPostImageUrl($item->get_content());
                # Analyse the possible tags of the item
                ##########################################
                # Get tags defined in the database for all posts of that feed
                $item_tags = array();
                # Get the tags on the feed
                $rs_feed_tag = $core->con->select("SELECT tag_id FROM " . $core->prefix . "feed_tag\r\n\t\t\t\t\tWHERE feed_id = " . $rs->feed_id);
                while ($rs_feed_tag->fetch()) {
                    $item_tags[] = strtolower($rs_feed_tag->tag_id);
                }
                # Get the reserved tags
                $reserved_tags = array();
                $planet_tags = getArrayFromList($blog_settings->get('planet_reserved_tags'));
                if (is_array($planet_tags)) {
                    foreach ($planet_tags as $tag) {
                        $reserved_tags[] = strtolower($tag);
                    }
                }
                # Get tags defined on the item in the feed
                $categs = $item->get_categories();
                if ($categs) {
                    foreach ($categs as $category) {
                        $label = strtolower($category->get_label());
                        if (!in_array($label, $item_tags) && !in_array($label, $reserved_tags) && !is_int($label) && strlen($label) > 1) {
                            $item_tags[] = $label;
                        }
                    }
                }
                # Find hashtags in title
                $hashtags = array();
                preg_match('/#([\\d\\w]+)/', $item->get_title(), $hashtags);
                foreach ($hashtags as $tag) {
                    $tag = strtolower($tag);
                    if (!in_array($tag, $item_tags) && !in_array($tag, $reserved_tags) && !is_int($tag) && strlen($tag) > 1) {
                        $item_tags[] = $tag;
                    }
                }
                # check if some existing tags are in the title
                foreach (explode(' ', $item_title) as $word) {
                    $word = strtolower($word);
                    $tagRq = $core->con->select('SELECT tag_id FROM ' . $core->prefix . 'post_tag WHERE tag_id = \'' . $word . "'");
                    if ($tagRq->count() > 1 && !in_array($word, $item_tags) && !in_array($word, $reserved_tags) && !is_int($word) && strlen($word) > 1) {
                        $item_tags[] = $word;
                    }
                }
                if (empty($item_content)) {
                    $log_msg = logMsg(sprintf(T_("No content on feed %s"), $rs->feed_url), "", 3, $print);
                } elseif (empty($permalink)) {
                    $log_msg = logMsg(T_("Error in link cutting : ") . $permalink, "", 3, $print);
                } else {
                    $log_msg = insertPostToDatabase($rs, $permalink, $item->get_date("U"), $item_title, $item_content, $item_tags, $item_image, $print, $rs->feed_id);
                    $cpt++;
                }
                # fin du $item->get_content()
                if ($print) {
                    $output .= $log_msg;
                }
            }
            # fin du foreach
            # Le flux a ete mis a jour, on le marque a la derniere date
            $cur = $core->con->openCursor($core->prefix . 'feed');
            $cur->feed_checked = array('NOW()');
            $cur->update("WHERE feed_id = '{$rs->feed_id}'");
            $log_msg = logMsg(sprintf(T_("The feed %s is updated"), $rs->feed_url), "", 2, $print);
            if ($print) {
                $output .= $log_msg;
            }
            # On fait un reset du foreach
            reset($items);
        }
        # fin $feed->error()
        # Destruction de l'objet feed avant de passer a un autre
        $feed->__destruct();
        unset($feed);
        if ($blog_settings->get('auto_feed_disabling')) {
            $toolong = time() - 86400 * 7;
            # seven days ago
            $check_sql = "SELECT feed_checked FROM " . $core->prefix . "feed WHERE feed_id=" . $rs->feed_id;
            $rs_check = $core->con->select($check_sql);
            $last_checked = mysqldatetime_to_timestamp($rs_check->f('feed_checked'));
            if ($last_checked < $toolong) {
                $diff = (time() - $last_checked) / 86400;
                $log_msg = logMsg(sprintf(T_("The feed was not updated since %d days. It'll be disabled : "), $diff) . $rs->feed_url, "", 2, $print);
                if ($print) {
                    $output .= $log_msg;
                }
                # if feed was in error for too long, let's disable it
                $cur = $core->con->openCursor($core->prefix . 'feed');
                $cur->feed_status = 2;
                $cur->update("WHERE feed_id = '{$rs->feed_id}'");
                $from = $blog_settings->get('author_mail');
                $to = $from . ',' . $rs->user_email;
                $reply_to = $from;
                $subject = sprintf(T_("Due to errors, a feed has been disabled on %s"), $blog_settings->get('planet_title'));
                $content = sprintf(T_("The feed of %s has been disabled :\n"), $rs->user_fullname);
                $content .= $rs->feed_url . "\n";
                $content .= sprintf(T_("The feed was in error during more than %d days"), $diff);
                $content .= "\n\n" . T_("Details :");
                $content .= "\n" . T_("User id : ") . $rs->user_id;
                $content .= "\n" . T_("User name : ") . $rs->user_fullname;
                $content .= "\n" . T_("User email : ") . $rs->user_email;
                $content .= "\n" . T_("Feed url : ") . $rs->feed_url;
                $content .= "\n" . T_("Last checked timestamp : ") . $last_checked;
                $content .= "\n" . T_("Website : ") . $rs->site_url;
                if (!sendmail($from, $to, $subject, $content, 'normal', $reply_to)) {
                    $log_msg = logMsg(T_("Email alert could not be send"));
                    if ($print) {
                        $output .= $log_msg;
                    }
                } else {
                    $log_msg = logMsg(T_("Feed disabled and email alert sent !"));
                    if ($print) {
                        $output .= $log_msg;
                    }
                }
            }
        }
    }
    # fin du while
    # Duree de la mise a jour
    $fin = explode(" ", microtime());
    $fin = $fin[1] + $fin[0];
    $temps_passe = round($fin - $debut, 2);
    $log_msg = logMsg("{$cpt} articles mis a jour en {$temps_passe} secondes", "", 2, $print);
    if ($print) {
        $output .= $log_msg;
    }
    return $output;
}
예제 #5
0
$scripts[] = "javascript/show-hide.js";
include dirname(__FILE__) . '/tpl.php';
#
header('Content-type: text/html; charset=utf-8');
# On recupere les infomations des articles
$sql = "SELECT\n\t\t\t" . $core->prefix . "post.post_id as post_id,\n\t\t\tuser_fullname as fullname,\n\t\t\tpost_pubdate as pubdate,\n\t\t\tpost_title,\n\t\t\tpost_permalink as permalink\n\t\tFROM " . $core->prefix . "post, " . $core->prefix . "user\n\t\tWHERE " . $core->prefix . "post.user_id = " . $core->prefix . "user.user_id\n\t\tAND post_status = '1'\n\t\tORDER BY post_pubdate DESC";
$rs = $core->con->select($sql);
$last_month = 0;
/* Boucle d'affichage des archives du mois */
$iter = 0;
while ($rs->fetch()) {
    $current_month = date('n', mysqldatetime_to_timestamp($rs->pubdate));
    $post = array("post_id" => $rs->post_id, "permalink" => $rs->permalink, "fullname" => $rs->fullname, "title" => htmlspecialchars_decode($rs->post_title), "head" => "");
    if ($current_month != $last_month && $iter > 0) {
        $post['head'] = "</ul>\n\t";
    }
    /* Si le mois de l'article est different du mois en cours */
    if ($current_month != $last_month) {
        $post['head'] .= '<h3>' . convertMonth($current_month) . ' ' . date("Y", mysqldatetime_to_timestamp($rs->pubdate)) . "</h3>\n\t<ul>";
    }
    $core->tpl->setVar('post', $post);
    $core->tpl->render('archives.line');
    $last_month = $current_month;
    $iter += 1;
}
if ($iter > 0) {
    $core->tpl->render('archives.closure');
}
$core->tpl->setVar('params', $params);
$core->tpl->render('content.archives');
$core->renderTemplate();
예제 #6
0
 function dates()
 {
     $tax1_desc = $this->settings_model->get_setting('tax1_desc');
     $tax2_desc = $this->settings_model->get_setting('tax2_desc');
     $tax1_rate = $this->settings_model->get_setting('tax1_rate');
     $tax2_rate = $this->settings_model->get_setting('tax2_rate');
     $start_date = $this->uri->segment(3, $this->input->post('startDate'));
     //ie: '2007-04-01';
     $end_date = $this->uri->segment(4, $this->input->post('endDate'));
     //ie: '2007-04-01';
     $start_date_timestamp = mysqldatetime_to_timestamp($start_date);
     $end_date_timestamp = mysqldatetime_to_timestamp($end_date);
     $date_error = (date("Y", $start_date_timestamp) == '1969' or date("Y", $end_date_timestamp) == '1969') ? TRUE : FALSE;
     // sanity checks
     $data['report_dates'] = 'Report for ' . date("Y-m-d", $start_date_timestamp) . ' to ' . date("Y-m-d", $end_date_timestamp);
     $detailed_data = $this->reports_model->getDetailedData($start_date, $end_date);
     $detailed_data_summary = $this->reports_model->getSummaryData($start_date, $end_date);
     if ($end_date_timestamp < $start_date_timestamp) {
         $data['data_table'] = '<p class="error">You\'ll need to pick a start date before that end date.</p>';
     } elseif ($date_error) {
         $data['data_table'] = '<p class="error">Looks like the dates somehow got messed up.  Probably easiest to go ' . anchor('reports', 'back to reports') . ' and try again.</p>';
     } elseif ($detailed_data->num_rows() > 0) {
         $tmpl = array('table_open' => '<table style="width: auto; margin: 0;" class="stripe">');
         $this->table->set_template($tmpl);
         $this->table->clear();
         if ($tax2_desc == '') {
             $this->table->set_heading($this->lang->line('invoice_client'), $this->lang->line('invoice_amount'), "{$tax1_desc} ({$tax1_rate}%)");
             foreach ($detailed_data->result() as $details) {
                 $this->table->add_row($details->name, $this->settings_model->get_setting('currency_symbol') . number_format($details->amount, 2, $this->config->item('currency_decimal'), ''), $this->settings_model->get_setting('currency_symbol') . number_format($details->tax1_collected, 2, $this->config->item('currency_decimal'), ''));
             }
             $this->table->add_row('<strong>Total</strong>', '<strong>' . $this->settings_model->get_setting('currency_symbol') . number_format($detailed_data_summary->amount, 2, $this->config->item('currency_decimal'), ''), '<strong>' . $this->settings_model->get_setting('currency_symbol') . number_format($detailed_data_summary->tax1_collected, 2, $this->config->item('currency_decimal'), '') . '</strong>');
         } else {
             $this->table->set_heading('Client', 'Total Billed', "{$tax1_desc} ({$tax1_rate}%)", "{$tax2_desc} ({$tax2_rate}%)");
             foreach ($detailed_data->result() as $details) {
                 $this->table->add_row($details->name, $this->settings_model->get_setting('currency_symbol') . number_format($details->amount, 2, $this->config->item('currency_decimal'), ''), $this->settings_model->get_setting('currency_symbol') . number_format($details->tax1_collected, 2, $this->config->item('currency_decimal'), ''), $this->settings_model->get_setting('currency_symbol') . number_format($details->tax2_collected, 2, $this->config->item('currency_decimal'), ''));
             }
             $this->table->add_row('<strong>' . $this->lang->line('invoice_total') . '</strong>', '<strong>' . $this->settings_model->get_setting('currency_symbol') . number_format($detailed_data_summary->amount, 2, $this->config->item('currency_decimal'), ''), '<strong>' . $this->settings_model->get_setting('currency_symbol') . number_format($detailed_data_summary->tax1_collected, 2, $this->config->item('currency_decimal'), '') . '</strong>', '<strong>' . $this->settings_model->get_setting('currency_symbol') . number_format($detailed_data_summary->tax2_collected, 2, $this->config->item('currency_decimal'), '') . '</strong>');
         }
         $data['data_table'] = $this->table->generate();
     } else {
         $data['data_table'] = '<p class="error">' . $this->lang->line('reports_no_data') . '</p>';
     }
     $data['page_title'] = $this->lang->line('menu_reports');
     $this->load->view('reports/dates', $data);
 }
예제 #7
0
        ?>
				<tr>
					<td><?php 
        echo $value->recipient_id;
        ?>
</td>
					<td><?php 
        echo $value->first_name;
        ?>
</td>
					<td><?php 
        echo $value->email;
        ?>
</td>
					<td><?php 
        echo mysqldatetime_to_timestamp($value->creation_date);
        ?>
</td>
					<td>
						<a href="<?php 
        echo base_url('reipient/manage/view/' . $value->recipient_id);
        ?>
" class="btn btn-success"><i class="fa fa-eye"></i>  View</a>
						<a href="<?php 
        echo base_url('reipient/manage/edit/' . $value->recipient_id);
        ?>
" class="btn btn-info"><i class="fa fa-pencil"></i>  Edit</a>
						<a href="<?php 
        echo base_url('reipient/manage/delete/' . $value->recipient_id);
        ?>
" class="btn btn-danger"><i class="fa fa-trash-o"></i>  Delete</a>
예제 #8
0
function checkSharedLinkCount($post_id, $return_engine = "")
{
    global $core, $blog_settings;
    $return = 0;
    $share_count = json_decode($blog_settings->get('planet_share_count'));
    foreach ($share_count as $engine) {
        $run_update = false;
        $nb_share = 0;
        $sql = "SELECT\n\t\t\t\tpost_id,\n\t\t\t\tengine,\n\t\t\t\tnb_share,\n\t\t\t\tmodified\n\t\t\tFROM " . $core->prefix . "post_share\n\t\t\tWHERE post_id = '{$post_id}' AND engine = '" . $engine . "'";
        $rs = $core->con->select($sql);
        if ($rs->count() == 0) {
            $run_update = true;
        } else {
            $last_update = mysqldatetime_to_timestamp($rs->f('modified'));
            $to_update = time() - 3600 * 12;
            if ($last_update - $to_update <= 0) {
                // the last update was more than 12h ago
                $run_update = true;
            }
        }
        if ($run_update) {
            switch ($engine) {
                case "twitter":
                    $nb_share = getNbTweet($post_id);
                    break;
                case "identica":
                    $nb_share = getNbDent($post_id);
                    break;
                default:
                    $nb_share = 0;
                    break;
            }
            $cur = $core->con->openCursor($core->prefix . 'post_share');
            $cur->nb_share = $nb_share;
            $cur->modified = array(' NOW() ');
            if ($rs->count() == 0) {
                $cur->post_id = $post_id;
                $cur->engine = $engine;
                $cur->created = array(' NOW() ');
                $cur->insert();
            } elseif ($nb_share > $rs->f('nb_share')) {
                $cur->update("WHERE post_id='{$post_id}' AND engine='{$engine}'");
            }
            if ($return_engine == $engine || $return_engine == "all") {
                $return += $nb_share;
            }
        } else {
            if ($return_engine == $engine || $return_engine == "all") {
                $return += $rs->f('nb_share');
            }
        }
    }
    return $return;
}