コード例 #1
0
ファイル: ADMIN.php プロジェクト: hatone/Nucleus-v3.64
 /**
  * @todo document this
  */
 function action_pluginoptionsupdate()
 {
     global $member, $manager;
     // check if allowed
     $member->isAdmin() or $this->disallow();
     $pid = intRequestVar('plugid');
     if (!$manager->pidInstalled($pid)) {
         $this->error(_ERROR_NOSUCHPLUGIN);
     }
     $aOptions = requestArray('plugoption');
     NucleusPlugin::_applyPluginOptions($aOptions);
     $manager->notify('PostPluginOptionsUpdate', array('context' => 'global', 'plugid' => $pid));
     $this->action_pluginoptions(_PLUGS_OPTIONS_UPDATED);
 }
コード例 #2
0
ファイル: index.php プロジェクト: stephenv/lcbo-notify
<?php

require 'Slim/Slim.php';
require 'Lib/simple_html_dom.php';
require 'Lib/includes.php';
\Slim\Slim::registerAutoloader();
$app = new \Slim\Slim();
$app->get('/', function () {
    echo "*hic*";
});
$app->get('/url/:type/:country', function ($type, $country) use($app) {
    $response = requestArray($type, $country);
    //print_r($response);
    $jsonResponse = json_encode($response);
    //Create json filename based on date time of request
    $dateResponse = (new DateTime('America/New_York'))->format('Y-m-d H-i-s');
    //Create request folder if does not already exist
    $folder = "Data/" . $type . "/" . $country . "/";
    if (!file_exists($folder)) {
        mkdir($folder, 0777, true);
    }
    //Add json response to file
    $filename = $folder . $dateResponse . ".json";
    file_put_contents($filename, $jsonResponse);
    //creates array of filenames in "Data" folder
    $requestHistory = scandir($folder, 1);
    //removes all values from the array that are not json files
    foreach ($requestHistory as $key => $ll) {
        if (strpos($ll, '.json') == false) {
            unset($requestHistory[$key]);
        } else {
コード例 #3
0
ファイル: ITEM.php プロジェクト: hatone/Nucleus-v3.64
 /**
  * Updates an item
  *
  * @static
  */
 function update($itemid, $catid, $title, $body, $more, $closed, $wasdraft, $publish, $timestamp = 0)
 {
     global $manager;
     $itemid = intval($itemid);
     // make sure value is 1 or 0
     if ($closed != 1) {
         $closed = 0;
     }
     // get destination blogid
     $new_blogid = getBlogIDFromCatID($catid);
     $old_blogid = getBlogIDFromItemID($itemid);
     // move will be done on end of method
     if ($new_blogid != $old_blogid) {
         $moveNeeded = 1;
     }
     // add <br /> before newlines
     $blog =& $manager->getBlog($new_blogid);
     if ($blog->convertBreaks()) {
         $body = addBreaks($body);
         $more = addBreaks($more);
     }
     // call plugins
     $manager->notify('PreUpdateItem', array('itemid' => $itemid, 'title' => &$title, 'body' => &$body, 'more' => &$more, 'blog' => &$blog, 'closed' => &$closed, 'catid' => &$catid));
     // update item itsself
     $query = 'UPDATE ' . sql_table('item') . ' SET' . " ibody='" . sql_real_escape_string($body) . "'," . " ititle='" . sql_real_escape_string($title) . "'," . " imore='" . sql_real_escape_string($more) . "'," . " iclosed=" . intval($closed) . "," . " icat=" . intval($catid);
     // if we received an updated timestamp in the past, but past posting is not allowed,
     // reject that date change (timestamp = 0 will make sure the current date is kept)
     if (!$blog->allowPastPosting() && $timestamp < $blog->getCorrectTime()) {
         $timestamp = 0;
     }
     if ($timestamp > $blog->getCorrectTime(time())) {
         $isFuture = 1;
         $query .= ', iposted=0';
     } else {
         $isFuture = 0;
         $query .= ', iposted=1';
     }
     if ($wasdraft && $publish) {
         // set timestamp to current date only if it's not a future item
         // draft items have timestamp == 0
         // don't allow timestamps in the past (unless otherwise defined in blogsettings)
         $query .= ', idraft=0';
         if ($timestamp == 0) {
             $timestamp = $blog->getCorrectTime();
         }
         // send new item notification
         if (!$isFuture && $blog->getNotifyAddress() && $blog->notifyOnNewItem()) {
             $blog->sendNewItemNotification($itemid, $title, $body);
         }
     }
     // save back to drafts
     if (!$wasdraft && !$publish) {
         $query .= ', idraft=1';
         // set timestamp back to zero for a draft
         $query .= ", itime=" . mysqldate($timestamp);
     }
     // update timestamp when needed
     if ($timestamp != 0) {
         $query .= ", itime=" . mysqldate($timestamp);
     }
     // make sure the correct item is updated
     $query .= ' WHERE inumber=' . $itemid;
     // off we go!
     sql_query($query);
     $manager->notify('PostUpdateItem', array('itemid' => $itemid));
     // when needed, move item and comments to new blog
     if ($moveNeeded) {
         ITEM::move($itemid, $catid);
     }
     //update the itemOptions
     $aOptions = requestArray('plugoption');
     NucleusPlugin::_applyPluginOptions($aOptions);
     $manager->notify('PostPluginOptionsUpdate', array('context' => 'item', 'itemid' => $itemid, 'item' => array('title' => $title, 'body' => $body, 'more' => $more, 'closed' => $closed, 'catid' => $catid)));
 }