public function __construct()
 {
     $this->url = URL::getInstance();
     $this->template = Template::getInstance();
     $this->request = Request::getInstance();
     $this->values = Values::getInstance();
 }
Esempio n. 2
0
 public static function getInstance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Esempio n. 3
0
 public function __construct($view)
 {
     try {
         parent::__construct(new \AltoRouter(), createInstance('App\\Routes\\Routes'), $view);
         $this->callMiddleware('_start')->callController()->callMiddleware('_end');
     } catch (\Exception $e) {
         $message = ['message' => $e->getMessage()];
         dump($message);
     }
 }
Esempio n. 4
0
 /**
  * Retrieves values by an array field or object property
  * @return array
  */
 public function execute()
 {
     $args = $this->getArguments();
     $field = null;
     if (count($args) === 1) {
         $field = $args[0];
     }
     if (is_string($field)) {
         return $this->computeRelatedFields($field);
     }
     return parent::execute();
 }
Esempio n. 5
0
File: index.php Progetto: bmp123/qu
	</div>
	<!-- <div id="menu">
		<ul>
			<li><a href="">Главная</a></li>
			<li><a href="partner">Партнерам</a></li>
			<li><a href="">Что мы делаем</a></li>
			<li><a href="">О нас</a></li>
		</ul>	
	</div> -->
	<div id="body">
		<?php 
if (isset($_GET['url'])) {
    echo Values::getFun();
}
if (!isset($_GET['url'])) {
    echo Values::viewCategory();
}
?>

		<div>
			
		</div>
	</div>
	<footer>
		<p class="copyright">&copy; Ivan Danilov</p>
	</footer>
</body>
</html>
<?php 
if (isset($_GET['id'])) {
    echo "<script type=\"text/javascript\">document.getElementById('wrapper').style.display = \"none\";document.getElementById('wrapper_cat').style.display = \"block\";</script>";
Esempio n. 6
0
 public function actionSaveProduct()
 {
     $product = Products::model()->findByPk($_POST['productId']);
     $attributes = json_decode($_POST['attributes']);
     //удмлим все значения, связанные с текущим атрибутом и сам атрибут
     $attributes_AR = Attributes::model()->findAll("product_id=:product_id", array(':product_id' => $_POST['productId']));
     foreach ($attributes_AR as $attribute) {
         Values::model()->deleteAll("attribute_id=:attribute_id", array(':attribute_id' => $attribute->id));
         $attribute->delete();
     }
     foreach ($attributes as $attribute) {
         $attribute_AR = new Attributes();
         $attribute_AR->product_id = $product->id;
         $attribute_AR->name = $attribute->name;
         $res = $attribute_AR->save();
         if ($res == false) {
             echo "false-attr";
             return;
         }
         foreach ($attribute->values as $value) {
             $value_AR = new Values();
             $value_AR->name = $value->name;
             $value_AR->add_price = $value->add_price;
             $value_AR->attribute_id = $attribute_AR->id;
             $res = $value_AR->save();
             if ($res == false) {
                 echo "false-value";
                 return;
             }
         }
     }
     $product->discount = $_POST['discount'];
     $product->name = $_POST['name'];
     $product->text = $_POST['text'];
     if ($_POST['photo'] != '') {
         $product->photo = $_POST['photo'];
     }
     $product->main_price = $_POST['main_price'];
     $product->sostav = $_POST['sostav'];
     $res = $product->update();
     if ($res == false) {
         var_dump($product->errors);
         echo "false-prod";
         return;
     }
     echo "true";
 }
Esempio n. 7
0
 /**
  * 
  * 设置游客信息缓存
  * @param {int} $ctype  客户端类型
  * @param {string} $type  缓存key值类型
  * @param {string} $GuestValue
  * @param {array} $aInfo
  * @return {ArrayIterator} setGuestCache
  */
 private function setGuestCache($ctype, $strkey, $GuestValue, $aInfo)
 {
     if (empty($GuestValue) || empty($aInfo) || !is_array($aInfo)) {
         return array();
     }
     $aGuestSysKeys = $aCacheInfo = array();
     if ($ctype == self::IOSCLIENTTYPE) {
         $aGuestSysKeys = self::$IOSGUESTKEY;
     } elseif ($ctype == self::ANDROIDCLIENTTYPE) {
         $aGuestSysKeys = self::$ANDROIDGUESTKEY;
     } else {
         return array();
     }
     $cTypeKey = self::$CACHETYPE[$strkey];
     $CacheKey = Core_keys::guestLoginMarkKey($GuestValue, $ctype, $cTypeKey);
     $aCacheInfo = Values::combine($aGuestSysKeys, $aInfo);
     if ($aCacheInfo[0]) {
         Loader_Redis::redisGuestMember()->set($CacheKey, json_encode($aCacheInfo), false, true, 86400 * self::GUESTTIMEPUTDAY);
     }
     return true;
 }
 public function deladdtask()
 {
     $otherdetails_id = Input::get('id');
     $delOD = OtherDetails::find($otherdetails_id);
     $delOD->delete();
     Values::where('otherDetails_id', $otherdetails_id)->delete();
     Session::put('successlabel', 'Successfully deleted task.');
     return Redirect::back();
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getValues()
 {
     return $this->hasOne(Values::className(), ['id' => 'values_id']);
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Values the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Values::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Esempio n. 11
0
 public function getValuesForTable()
 {
     $valuesModel = new Values();
     // filter by group
     if ($this->currentGroup) {
         $values = $valuesModel->get(['group_id' => $this->currentGroup]);
     } else {
         $values = $valuesModel->get();
     }
     foreach ($values as $eachObj) {
         // filter by search
         if (isset($_POST['s'])) {
             if (mb_stripos($eachObj->label, $_POST['s']) === false && mb_stripos($eachObj->slug, $_POST['s']) === false) {
                 continue;
             }
         }
         $output[] = ['sg_id' => $eachObj->id, 'sg_label' => $eachObj->label, 'sg_slug' => $eachObj->slug, 'sg_value' => $this->getValueFromObject($eachObj), 'sg_action' => $this->getActions($eachObj)];
     }
     if (!isset($output)) {
         $output = [];
     }
     return $output;
 }
Esempio n. 12
0
function remove($input)
{
    $valueObj = new Values();
    if (is_array($input)) {
        foreach ($input as $query) {
            if ((is_string($query) || is_int($query)) && intval($query)) {
                $output = $valueObj->delete(['id' => $query]);
            } else {
                $output = $valueObj->delete(['slug' => $query]);
            }
        }
    } else {
        if ((is_string($input) || is_int($input)) && intval($input)) {
            $output = $valueObj->delete(['id' => $input]);
        } else {
            $output = $valueObj->delete(['slug' => $input]);
        }
    }
    return isset($output) && $output ? true : false;
}
Esempio n. 13
0
<?php

header('Content-Type: text/html; charset=utf-8');
require_once "../assets/values.php";
?>
<!DOCTYPE html>
<html>
<head lang="ru">
    <?php 
echo Values::request_url();
?>
	<script src="../js/jquery.mask.js" type="text/javascript"></script>
	<title>Место где можно занять очередь</title>
</head>
<body>
	<header>
		<b>Какое то предложение</b>
	</header>
	<div id="menu">
		<ul>
			<li><a href="">Главная</a></li>
			<li><a href="">Партнерам</a></li>
			<li><a href="">Что мы делаем</a></li>
			<li><a href="">О нас</a></li>
		</ul>	
	</div>
	<div id="body">
		<input type="text" name="name" id="name" placeholder="name">
		<input type="text" name="number" id="number" placeholder="number">
		<input type="email" name="email" id="email" placeholder="email">
		<input type="password" name="password" id="password" placeholder="password">
Esempio n. 14
0
File: sql.php Progetto: rair/yacs
 /**
  * purge idle space
  *
  * This function OPTIMIZEs tables that may create overheads because of
  * frequent deletions, including: cache, links, members, messages,
  * notifications, values, versions, visits.
  *
  * Last purge is recorded as value 'sql.tick'.
  *
  * @param boolean optional TRUE to not report on any error
  * @return a string to be displayed in resulting page, if any
  */
 public static function purge($silent = FALSE)
 {
     global $context;
     // useless if we don't have a valid database connection
     if (!$context['connection']) {
         return;
     }
     // remember start time
     $stamp = get_micro_time();
     // get date of last tick
     include_once $context['path_to_root'] . 'shared/values.php';
     $record = Values::get_record('sql.tick', NULL_DATE);
     // wait at least 8 hours = 24*3600 seconds between ticks
     if (isset($record['edit_date'])) {
         $target = SQL::strtotime($record['edit_date']) + 8 * 3600;
     } else {
         $target = time();
     }
     // request to be delayed
     if ($target > time()) {
         return 'shared/sql.php: wait until ' . gmdate('r', $target) . ' GMT' . BR;
     }
     // recover unused bytes
     $query = 'OPTIMIZE TABLE ' . SQL::table_name('cache') . ', ' . SQL::table_name('links') . ', ' . SQL::table_name('members') . ', ' . SQL::table_name('messages') . ', ' . SQL::table_name('notifications') . ', ' . SQL::table_name('values') . ', ' . SQL::table_name('versions') . ', ' . SQL::table_name('visits');
     $result = SQL::query($query, $silent);
     // remember tick date and resulting text
     Values::set('sql.tick', 'purge');
     // compute execution time
     $time = round(get_micro_time() - $stamp, 2);
     // report on work achieved
     if ($result) {
         return 'shared/sql.php: unused bytes have been recovered (' . $time . ' seconds)' . BR;
     } else {
         return 'shared/sql.php: nothing to recover (' . $time . ' seconds)' . BR;
     }
 }
Esempio n. 15
0
File: setup.php Progetto: rair/yacs
/**
 * dynamically generate the page
 *
 * @see skins/index.php
 */
function send_body()
{
    global $context, $action;
    // check that the user is an admin, but only if there is at least one user record
    $query = "SELECT count(*) FROM " . SQL::table_name('users');
    if (!Surfer::is_associate() && SQL::query($query) !== FALSE) {
        Safe::header('Status: 401 Unauthorized', TRUE, 401);
        echo '<p>' . i18n::s('You are not allowed to perform this operation.') . "</p>\n";
        return;
    }
    // log the current surfer as an associate if not yet the case
    if (!Surfer::is_associate()) {
        $fields = array();
        $fields['id'] = 1;
        $fields['nick_name'] = 'admin';
        $fields['email'] = '';
        $fields['capability'] = 'A';
        Surfer::set($fields);
        echo '<p>' . i18n::s('You have associate privilege') . '</p>';
    }
    // check every table of the database
    if ($action == 'build') {
        // maybe we will have to switch the server off
        $temporary_off = FALSE;
        // ensure nobody else will access the database during the operation
        if (file_exists('../parameters/switch.on')) {
            if (Safe::rename($context['path_to_root'] . 'parameters/switch.on', $context['path_to_root'] . 'parameters/switch.off')) {
                echo BR . i18n::s('The server has been switched off.');
                $temporary_off = TRUE;
            }
            // let concurrent on-going transactions finish properly
            Safe::sleep(3);
            // first installation
        } elseif (!file_exists('../parameters/switch.off')) {
            echo '<p>' . i18n::s('Review provided information and go to the bottom of the page to move forward.') . "</a></p>\n";
        }
        // ensure utf8 character set for this database
        $query = "ALTER DATABASE `" . $context['database'] . "`  DEFAULT CHARACTER SET utf8";
        SQL::query($query);
        // create tables for users
        echo Users::setup();
        // create tables for activities
        echo Activities::setup();
        // create tables for notifications
        include_once '../users/notifications.php';
        echo Notifications::setup();
        // create tables for messages
        echo Mailer::setup();
        // create tables for visits
        include_once '../users/visits.php';
        echo Visits::setup();
        // create tables for sections
        echo Sections::setup();
        // create tables for articles
        echo Articles::setup();
        // create tables for images
        include_once '../images/images.php';
        echo Images::setup();
        // create tables for tables
        include_once '../tables/tables.php';
        echo Tables::setup();
        // create tables for files
        echo Files::setup();
        // create tables for links
        include_once '../links/links.php';
        echo Links::setup();
        // create tables for locations
        include_once '../locations/locations.php';
        echo Locations::setup();
        // create tables for comments
        include_once '../comments/comments.php';
        echo Comments::setup();
        // create tables for categories
        echo Categories::setup();
        // create tables for members
        include_once '../shared/members.php';
        echo Members::setup();
        // create tables for dates
        include_once '../dates/dates.php';
        echo Dates::setup();
        // create tables for servers
        include_once '../servers/servers.php';
        echo Servers::setup();
        // create tables for versions
        include_once '../versions/versions.php';
        echo Versions::setup();
        // create tables for enrolments
        include_once '../shared/enrolments.php';
        echo Enrolments::setup();
        // create tables for values
        include_once '../shared/values.php';
        echo Values::setup();
        // create tables for the cache
        echo Cache::setup();
        // create tables for the php documentation
        include_once '../scripts/phpdoc.php';
        echo PhpDoc::setup();
        // the setup hook
        if (is_callable(array('Hooks', 'include_scripts'))) {
            echo Hooks::include_scripts('control/setup.php');
        }
        // reopen the server for others
        if ($temporary_off && Safe::rename($context['path_to_root'] . 'parameters/switch.off', $context['path_to_root'] . 'parameters/switch.on')) {
            echo '<p>' . i18n::s('The server has been switched on.') . '</p>';
        }
        // in the middle of an update
        if (file_exists('../parameters/switch.off')) {
            echo Skin::build_block('<form method="get" action="../scripts/run_once.php">' . "\n" . '<p class="assistant_bar">' . Skin::build_submit_button(i18n::s('Run one-time scripts and go to the Control Panel')) . '</p>' . "\n" . '</form>', 'bottom');
            // this may take several minutes
            echo '<p>' . i18n::s('When you will click on the button the server will be immediately requested to proceed. However, because of the so many things to do on the back-end, you may have to wait for minutes before getting a response displayed. Thank you for your patience.') . '</p>';
            // populate the database on first installation
        } elseif (!file_exists('../parameters/switch.on')) {
            echo Skin::build_block('<form method="get" action="populate.php">' . "\n" . '<p class="assistant_bar">' . Skin::build_submit_button(i18n::s('Initialize the database')) . '</p>' . "\n" . '</form>', 'bottom');
            // or back to the control panel
        } else {
            $menu = array('control/' => i18n::s('Control Panel'));
            echo Skin::build_list($menu, 'menu_bar');
        }
        // clear the cache
        Cache::clear();
        // remember the change
        $label = i18n::c('The database has been optimised');
        Logger::remember('control/setup.php: ' . $label);
        // ask for confirmation
    } else {
        // the splash message
        echo '<p>' . i18n::s('This script will check the structure of the database and optimize data storage:') . '</p>' . "\n" . '<ul>' . "\n" . '<li>' . i18n::s('Missing tables will be created, if necessary.') . '</li>' . "\n" . '<li>' . i18n::s('Some columns may be created or converted if their type has evolved.') . '</li>' . "\n" . '<li>' . i18n::s('All indexes will be (re)built.') . '</li>' . "\n" . '<li>' . i18n::s('Data files will be optimized as well.') . '</li>' . "\n" . '</ul>' . "\n";
        // the submit button
        echo '<form method="post" action="' . $context['script_url'] . '" id="main_form"><p>' . Skin::build_submit_button(i18n::s('Ensure the database structure is accurate'), NULL, NULL, 'confirmed') . '<input type="hidden" name="action" value="build" />' . '</p></form>';
        // the script used for form handling at the browser
        Page::insert_script('$("#confirmed").focus();');
        // this may take several minutes
        echo '<p>' . i18n::s('When you will click on the button the server will be immediately requested to proceed. However, because of the so many things to do on the back-end, you may have to wait for minutes before getting a response displayed. Thank you for your patience.') . '</p>';
    }
}
Esempio n. 16
0
 /**
  * getType() をテストします.
  * 以下を確認します.
  * 
  * - オブジェクト以外の引数については, gettype() と同じ結果になること
  * - オブジェクトについては, そのオブジェクトのクラス名を返すこと
  * 
  * @covers Peach\Util\Values::getType
  */
 public function testGetType()
 {
     $tests = array(array(123, "integer"), array("asdf", "string"), array(new \stdClass(), "stdClass"));
     foreach ($tests as $test) {
         $this->assertSame($test[1], Values::getType($test[0]));
     }
 }
Esempio n. 17
0
 /**
  * process new uploads, if any
  *
  * This function checks the input queue, and process new files on their arrival.
  *
  * This function is aiming to run silently, therefore errors are logged in a file.
  *
  * @return a string to be displayed in resulting page, if any
  *
  */
 public static function tick_hook()
 {
     global $context;
     // useless if we don't have a valid database connection
     if (!$context['connection']) {
         return;
     }
     // remember start time
     $stamp = get_micro_time();
     // process handx weblog entries, if any
     $count = 0;
     if (($files = Uploads::list_files('inbox/entries')) && @count($files) > 0) {
         foreach ($files as $file) {
             // help the webmaster
             Logger::remember('agents/upload.php: processing ' . $file);
             // create articles
             Uploads::process_handx_weblog($file);
             // no more than 10 entries per tick
             $count += 1;
             if ($count >= 10) {
                 break;
             }
         }
         // remember tick date
         include_once $context['path_to_root'] . 'shared/values.php';
         Values::set('uploads.tick.entries', $count);
     }
     // rebuild index pages
     if ($count) {
         Cache::clear();
     }
     // compute execution time
     $time = round(get_micro_time() - $stamp, 2);
     // report on work achieved
     if ($count > 1) {
         return 'agents/uploads.php: ' . $count . ' files have been processed (' . $time . " seconds)" . BR;
     } elseif ($count == 1) {
         return 'agents/uploads.php: 1 file has been processed (' . $time . " seconds)" . BR;
     } else {
         return 'agents/uploads.php: nothing to do (' . $time . " seconds)" . BR;
     }
 }
Esempio n. 18
0
 /**
  * コンストラクタの第一引数が指定された場合に実行される,
  * マッピングの初期化処理です.
  * 
  * @param Map|array $map
  */
 private function initTable(&$map)
 {
     if ($map instanceof Map) {
         $entryList = $map->entryList();
         foreach ($entryList as $entry) {
             $this->put($entry->getKey(), $entry->getValue());
         }
         return;
     }
     if (is_array($map)) {
         foreach ($map as $key => $value) {
             $this->put($key, $value);
         }
         return;
     }
     throw new \InvalidArgumentException("Argument (" . Values::getType($map) . ") must be array or \\Peach\\Util\\Map");
 }
Esempio n. 19
0
File: cron.php Progetto: rair/yacs
}
//
// daily jobs
//
echo 'Checking daily jobs...' . BR;
// get date of last run
$record = Values::get_record('cron.daily', NULL_DATE);
// wait at least 1 day = 86400 seconds between runs
if (isset($record['edit_date'])) {
    $target = SQL::strtotime($record['edit_date']) + 86400;
} else {
    $target = time();
}
// request to be delayed
if ($target > time()) {
    echo 'Wait until ' . gmdate('r', $target) . ' GMT' . BR;
} else {
    Values::set('cron.daily', 'running...');
    // do the job and provide feed-back to user
    $context['text'] = Hooks::include_scripts('daily');
    echo $context['text'];
    // remember tick date and resulting text
    Values::set('cron.daily', $context['text']);
    // log outcome of script execution in debug mode
    if ($context['with_debug'] == 'Y') {
        Logger::remember('cron.php: daily processing', $context['text'], 'debug');
    }
}
// all done
$time = round(get_micro_time() - $context['start_time'], 2);
exit(sprintf('Script terminated in %.2f seconds.', $time) . BR);
Esempio n. 20
0
 public function testValidateMultiColumnMultiException()
 {
     $values = new Values();
     try {
         $values->fill(['foo6' => '', 'foo7' => '1']);
         $this->assertTrue(false);
     } catch (\T4\Core\MultiException $e) {
         $this->assertCount(3, $e);
         $this->assertEquals('Empty!', $e[0]->getMessage());
         $this->assertEquals('Too short!', $e[1]->getMessage());
         $this->assertEquals('Too short!', $e[2]->getMessage());
     }
 }
Esempio n. 21
0
 /**
  * 用户资料更新
  * @param int $mid
  * @param array $fields
  **/
 public function updateInfo($mid, $fields = array())
 {
     $update = "";
     foreach ($fields as $key => $val) {
         if (is_null($val)) {
             continue;
         }
         $update .= $key . "='" . $val . "',";
     }
     $update = substr($update, 0, -1);
     $sql = "UPDATE {$this->memberinfo} SET {$update} WHERE mid={$mid} LIMIT 1";
     $flag = Loader_Mysql::dbmaster()->query($sql);
     if ($flag) {
         //更新成功 更新缓存
         $aUser = Member::factory()->getOneById($mid, false);
         foreach ($fields as $key => $val) {
             if (isset($aUser[$key])) {
                 $aUser[$key] = $val;
             }
         }
         //更新缓存
         $cacheKey = Core_Keys::getOneById($mid);
         return Loader_Memcached::minfo($mid)->set($cacheKey, Values::combine(Values::getmb(), $aUser), 3 * 24 * 3600);
     }
     return false;
 }
Esempio n. 22
0
 /**
  * 指定されたキー名と値を関連づけます.
  * この実装では, 内部に保存されている配列に対して
  * <code>
  * $arr[$key] = $value;
  * </code>
  * を実行するのと同等の操作を行います.
  * もしも $key に非スカラー値 (オブジェクトや配列など) が指定された場合は,
  * {@link Values::stringValue} で string 型に変換した結果をキーとします.
  * 
  * @param  string $key   キー名
  * @param  mixed  $value 指定されたキーに関連づける値
  */
 public function put($key, $value)
 {
     if (!is_scalar($key)) {
         $key = Values::stringValue($key);
     }
     $this->data[$key] = $value;
 }
Esempio n. 23
0
File: Network.php Progetto: 0-php/AI
 /**
  * Set Values for training or using network
  *
  * Set Values of inputs and outputs for training or just inputs for using
  * already trained network.
  *
  * <code>
  * $objNetwork = new \ANN\Network(2, 4, 1);
  *
  * $objValues = new \ANN\Values;
  *
  * $objValues->train()
  *           ->input(0.12, 0.11, 0.15)
  *           ->output(0.56);
  *
  * $objNetwork->setValues($objValues);
  * </code>
  *
  * @param Values $objValues
  * @uses Values::getInputsArray()
  * @uses Values::getOutputsArray()
  * @uses setInputs()
  * @uses setOutputs()
  * @since 2.0.6
  */
 public function setValues(Values $objValues)
 {
     $this->setInputs($objValues->getInputsArray());
     $this->setOutputs($objValues->getOutputsArray());
 }
Esempio n. 24
0
 public function sgDeleteGroup()
 {
     $this->checkPermissions($_POST['_wpnonce'], 'sg-delete-group');
     $grObj = new Groups();
     $grObj->returnMessages = true;
     $result = $grObj->delete(['id' => $_POST['id']]);
     $output['result'] = $result['result'];
     $output['messages'] = $result['messages']['error'];
     if ($output['result']) {
         $valObj = new Values();
         $valObj->delete(['group_id' => $_POST['id']]);
     }
     echo json_encode($output, JSON_UNESCAPED_UNICODE);
     die;
 }
Esempio n. 25
0
File: values.php Progetto: rair/yacs
 /**
  * retrieve date of last value update
  *
  * @param string the id of the value to be retrieved
  * @return string modification date, or '0000-00-00'
  */
 public static function get_stamp($id)
 {
     global $context;
     // get one attribute of the record
     if ($item = Values::get_record($id)) {
         $item = $item['edit_date'];
     } else {
         $item = NULL_DATE;
     }
     return $item;
 }
Esempio n. 26
0
 /**
  * process new messages, if any
  *
  * This function checks inbound mailboxes, and process new messages on their arrival.
  *
  * This function is aiming to run silently, therefore errors are logged in a file.
  *
  * @return a string to be displayed in resulting page, if any
  */
 public static function tick_hook()
 {
     global $context;
     // useless if we don't have a valid database connection
     if (!$context['connection']) {
         return;
     }
     // we need some queue definitions
     Safe::load('parameters/agents.include.php');
     if (!isset($context['mail_queues']) || !is_array($context['mail_queues']) || !count($context['mail_queues'])) {
         return 'agents/messages.php: no queue has been defined' . BR;
     }
     // remember start time
     $stamp = get_micro_time();
     // process each inbound queue
     include_once $context['path_to_root'] . 'shared/values.php';
     // messages.tick
     $count = 0;
     foreach ($context['mail_queues'] as $name => $queue) {
         // count messages retrieved
         $messages = Messages::process_queue($queue);
         $count += $messages;
         // remember tick date
         Values::set('messages.tick.' . $name, $messages);
     }
     // rebuild index pages
     if ($count) {
         Cache::clear();
     }
     // compute execution time
     $time = round(get_micro_time() - $stamp, 2);
     // report on work achieved
     if ($count > 1) {
         return 'agents/messages.php: ' . $count . ' messages have been processed (' . $time . ' seconds)' . BR;
     } elseif ($count == 1) {
         return 'agents/messages.php: 1 message has been processed (' . $time . ' seconds)' . BR;
     } else {
         return 'agents/messages.php: nothing to do (' . $time . ' seconds)' . BR;
     }
 }
Esempio n. 27
0
File: new.php Progetto: rair/yacs
    if ($recipients_ok == 0) {
        $context['text'] .= i18n::s('No letter has been transmitted.') . BR . "\n";
    } elseif ($recipients_ok == 1) {
        $context['text'] .= i18n::s('One letter has been transmitted.') . BR . "\n";
    } else {
        $context['text'] .= sprintf(i18n::s('%d letters have been transmitted.'), $recipients_ok) . BR . "\n";
    }
    // transmission errors, if any
    if ($recipients_errors == 1) {
        $context['text'] .= i18n::s('One transmission error has been encountered.') . BR . "\n";
    } elseif ($recipients_errors > 1) {
        $context['text'] .= sprintf(i18n::s('%d transmission errors have been encountered.'), $recipients_errors) . BR . "\n";
    }
    // save digest stamp, if any
    if (isset($_REQUEST['digest_stamp']) && $_REQUEST['digest_stamp'] > NULL_DATE) {
        Values::set('letters.digest.stamp', $_REQUEST['digest_stamp']);
    }
    // display the execution time
    $time = round(get_micro_time() - $context['start_time'], 2);
    $context['text'] .= '<p>' . sprintf(i18n::s('Script terminated in %.2f seconds.'), $time) . '</p>';
    // forward to the index page
    $menu = array('letters/' => i18n::s('Newsletters'));
    $context['text'] .= Skin::build_list($menu, 'menu_bar');
    // make the user select an option
} else {
    // the splash message
    $context['text'] .= '<p>' . i18n::s('This script will help you to prepare and to send a electronic message to community members. Please select below the action you would like to perform. Depending on your choice, the assistant may ask for additional parameters on successive panels.') . '</p>' . "\n";
    // the form
    $context['text'] .= '<form method="get" action="' . $context['script_url'] . '" id="main_form">' . "\n";
    // a digest of most recent articles
    $context['text'] .= '<p><input type="radio" name="action" value="digest" selected="selected" /> ' . i18n::s('Send a digest of articles published recently') . '</p>' . "\n";
Esempio n. 28
0
 /**
  * 文字列内に含まれる {0}, {1}, {2} などのテンプレート変数を, $args 内の各要素で置き換えます. 例えば
  * <code>
  * template('My name is {0}. I am {1} years old', array('Taro', 18));
  * </code>
  * の結果は次のようになります.
  * <code>
  * "My name is Taro. I am 18 years old"
  * </code>
  * 
  * $template が NULL の場合は NULL を返します.
  * 
  * @param  string $template テンプレート
  * @param  array  $args     置き換える内容の配列
  * @return string           テンプレートの適用結果
  */
 public static function template($template, array $args = array())
 {
     if ($template === null) {
         return null;
     }
     $subject = Values::stringValue($template);
     $replaces = array();
     foreach ($args as $key => $value) {
         $from = "{" . $key . "}";
         $replaces[$from] = $value;
     }
     return strtr($subject, $replaces);
 }
        @endif
            <?php 
            //End Task Display
            $sectiondays = $sectiondays + $taskp->daysOfAction;
            $prdays = $prdays + $taskp->daysOfAction;
            echo "</tr>";
        }
        //Addon Display
        $otherc = OtherDetails::where('section_id', $sections->id)->count();
        if ($otherc != 0) {
            $otherd = OtherDetails::where('section_id', $sections->id)->get();
            foreach ($otherd as $otherdetails) {
                if ($otherdetails->label == "Total Days for BAC Documents Preparation" || $otherdetails->label == "Compliance" || $otherdetails->label == "Remarks") {
                    echo "<tr><td width='30%'><b>" . $otherdetails->label . "</b></td>";
                    $valuesc = Values::where('otherDetails_id', $otherdetails->id)->where('purchase_request_id', $purchase->id)->count();
                    $values = Values::where('otherDetails_id', $otherdetails->id)->where('purchase_request_id', $purchase->id)->first();
                    ?>
                @if ($valuesc==0)
                <td colspan='3'> </td>
                <?php 
                    continue;
                    ?>
                @else
                <td width='48%' colspan='3' align="center">{{$values->value}}</td>


                </tr>
                @endif
            <?php 
                }
            }
Esempio n. 30
0
 /**
  * 用戶完成新手教程更新
  * @param $mid
  * @param $param 要更新的參數
  */
 public function updateUserParam($mid, $param = array())
 {
     if (!($mid = Helper::uint($mid))) {
         return false;
     }
     $update = "";
     if (isset($param['mtaskcount'])) {
         $update .= ",mtaskcount=mtaskcount+1";
     }
     if ($update) {
         $update = substr($update, 1);
         $query = "UPDATE {$this->members} SET {$update} WHERE mid={$mid} LIMIT 1";
         Loader_Mysql::dbmaster()->query($query);
         if (Loader_Mysql::dbmaster()->affectedRows()) {
             //更新 cache
             $aUser = $this->getOneById($mid, false);
             $aUser['mtaskcount'] += 1;
             $cacheKey = Core_Keys::getOneById($mid);
             $flag = Loader_Memcached::minfo($mid)->set($cacheKey, Values::combine(Values::getmb(), $aUser), 10 * 24 * 3600);
         } else {
             $flag = false;
         }
     }
     return $flag;
 }