PHPCow Help

Full Version: My Article Date Ends at 2010
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Our PHPCOW has an end date for its articles of 2010 and can not enter anything into 2011 or later.

Can we get our PHPCOW Updated so that we can enter 2011 and above? What do you want for it?

Thank you so much, Joseph.

Have a GREAT Day!

Daryl
----------------------------------------------------
Daryl Burns
Vantage Media Marketing Inc.
daryl@VantageMediaMarketing.com
http://www.BabyBoomer-Magazine.com
Daryl@BabyBoomer-Magazine.com
626-303-0767
800-761-3996
----------------------------------------------------
WOW!!! Just saw this!!!

Its huge problem... anyone got any ideas???
Hello i found the solution to this:

Create a new php file and name it form.class.php

Then copy and paste this code into it:

Code:
<?
class form
  {
    var $fields = null;
    var $lastTplId = null;
    var $months = null;
    function form ()
    {
      $this->fields = array ();
      $this->lastTplId = -1;
      $this->months = array ('01' => 'January', '02' => 'February', '03' => 'March', '04' => 'April', '05' => 'May', '06' => 'June', '07' => 'July', '08' => 'August', '09' => 'September', '10' => 'October', '11' => 'November', '12' => 'December');
    }

    function gettextbox ($name, $params = array (), $index = -1)
    {
      $width = '';
      $class = '';
      $default = '';
      if (sizeof ($params))
      {
        if (isset ($params['width']))
        {
          $width = ' style="width:' . $params['width'] . '"';
        }

        if (isset ($params['class']))
        {
          $class = ' class="' . $params['class'] . '"';
        }

        if (isset ($params['default']))
        {
          $default = $params['default'];
        }
      }

      return '<input type="text" name="' . $this->getName ($name, $index) . '" value="' . $this->getFieldValue ($name, $index) . '"' . $width . $class . '>';
    }

    function gettextfield ($name, $params = array (), $index = -1)
    {
      $width = '';
      $class = '';
      $default = '';
      if (sizeof ($params))
      {
        if (isset ($params['width']))
        {
          $width = ' style="width:' . $params['width'] . '"';
        }

        if (isset ($params['class']))
        {
          $class = ' class="' . $params['class'] . '"';
        }

        if (isset ($params['default']))
        {
          $default = $params['default'];
        }
      }

      return '<input type="text" name="' . $this->getName ($name, $index) . '" value="' . $this->getFieldValue ($name, $index) . '"' . $width . $class . '>';
    }

    function getnumeric ($name, $default = 0, $params = array (), $index = -1)
    {
      $width = '';
      $class = '';
      if (0 < sizeof ($params))
      {
        if (isset ($params['width']))
        {
          $width = ' style="width:' . $params['width'] . '"';
        }

        if (isset ($params['class']))
        {
          $class = ' class="' . $params['class'] . '"';
        }

        if (isset ($params['default']))
        {
          $default = $params['default'];
        }
      }

      $tmp_val = $this->getFieldValue ($name, $index);
      if (!((!($tmp_val == '') AND is_numeric ($tmp_val))))
      {
        $tmp_val = $default;
      }

      return '<input type="text" name="' . $this->getName ($name, $index) . '" value="' . (string)$tmp_val . '"' . $width . $class . '>';
    }

    function gethidden ($name, $index = -1)
    {
      return '<input type="hidden" name="' . $this->getName ($name, $index) . '" value="' . $this->getFieldValue ($name, $index) . '">';
    }

    function getcheckbox ($name, $index = -1)
    {
      $checked = ($this->getFieldValue ($name, $index) ? 'checked' : '');
      return '<input type="hidden" name="' . $this->getName ($name, $index) . '" value="0"><input type="checkbox" name="' . $this->getName ($name, $index) . '" value="1" ' . $checked . '>';
    }

    function gettextarea ($name, $params = array (), $index = -1)
    {
      if (isset ($params['cols']))
      {
        (true ? is_numeric ($params['cols']) : $params['cols']);
      }

      $cols = 25;
      if (isset ($params['rows']))
      {
        (true ? is_numeric ($params['rows']) : $params['rows']);
      }

      $rows = 15;
      $htm[] = '<textarea name="' . $this->getName ($name, $index) . '" cols="' . $cols . '" rows="' . $rows . '">' . $this->getFieldValue ($name, $index) . '</textarea>';
      return implode ('
', $htm);
    }

    function getselect ($name, $values, $with_keys = 0, $index = -1, $onChange = '')
    {
      $selected = '';
      $elementName = $this->getName ($name, $index);
      $htm[] = '<select name="' . $elementName . '" id="' . $elementName . '" ' . ($onChange ? 'onchange="' . $onChange . '"' : '') . '>';
      if (is_array ($values))
      {
        foreach ($values as $key => $value)
        {
          if ($with_keys)
          {
            $selected = ($this->getFieldValue ($name, $index) == $key ? 'selected' : '');
            $htm[] = '<option value="' . $key . '" ' . $selected . '>' . $value;
            continue;
          }
          else
          {
            $selected = ($this->getFieldValue ($name, $index) == $value ? 'selected' : '');
            $htm[] = '<option ' . $selected . '>' . $value;
            continue;
          }
        }
      }

      $htm[] = '</select>';
      return implode ('
', $htm);
    }

    function getmultiselect ($name, $values, $with_keys = 0, $index = -1)
    {
      $i = 0;
      $realName = substr ($name, 0, strlen ($name) - 2);
      if (isset ($this->fields[$realName]))
      {
        $tmp = array_flip ($this->fields[$realName]);
      }

      $htm[] = '<select name="' . $name . '" class="clsProperties" multiple size="4">';
      foreach ($values as $key => $value)
      {
        if (!($with_keys))
        {
          if (isset ($tmp))
          {
            if (isset ($tmp[$key]))
            {
              $htm[] = '<option selected="selected">' . $value;
            }
          }
          else
          {
            $htm[] = '<option>' . $value;
          }
        }
        else
        {
          if (isset ($tmp))
          {
            if (isset ($tmp[$key]))
            {
              $htm[] = '<option selected="selected" value="' . $key . '">' . $value;
            }
          }
          else
          {
            $htm[] = '<option value="' . $key . '">' . $value;
          }
        }

        ++$i;
      }

      $htm[] = '</select>';
      return implode ('
', $htm);
    }

    function getradiobuttons ($name, $values, $use_caption = 0)
    {
      $htm = array ();
      if (is_array ($values))
      {
        foreach ($values as $caption => $value)
        {
          $checked = ($this->getFieldValue ($name) == $value ? 'checked' : '');
          $htm[] = ($use_caption ? $caption : '') . '<input type="radio" name="' . $name . '" value="' . $value . '" ' . $checked . '>';
        }
      }
      else
      {
        $checked = ($this->getFieldValue ($name) == $values ? 'checked' : '');
        $htm[] = '<input type="radio" name="' . $name . '" value="' . $values . '" ' . $checked . '>';
      }

      return implode ('
', $htm);
    }

    function getradio ($name, $value)
    {
      $fieldValue = $this->getFieldValue ($name);
      if ($fieldValue)
      {
        (true ? $fieldValue == $value : 'checked');
      }

      $checked = '';
      return '<input type="radio" name="' . $name . '" value="' . $value . '" ' . $checked . '>';
    }

    function getfile ($name, $index = -1, $onchange = '')
    {
      return '<input type="file" name="' . $this->getName ($name, $index) . '", onchange="' . $onchange . '">';
    }

    function getsubmit ($name, $value, $onclick = '', $index = -1)
    {
      if ($onclick != '')
      {
        $onclick = ' onclick="' . $onclick . '"';
      }

      return '<input type="submit" class="button" name="' . $this->getName ($name, $index) . '" value="' . $value . '"' . $onclick . '>';
    }

    function getimagesubmit ($name, $src, $onclick = '', $alt = '', $wh = array ('width' => 15, 'height' => 15))
    {
      if ($onclick != '')
      {
        $onclick = ' onclick="' . $onclick . '"';
      }

      return '<input style="border: 0px; width: ' . $wh['width'] . 'px; height: ' . $wh['height'] . 'px" type="image" title="' . $alt . '" class="button" name="' . $this->getName ($name, -1) . '" src="' . $src . '"' . $onclick . '>';
    }

    function getbutton ($name, $value, $onclick = '', $index = -1)
    {
      if ($onclick != '')
      {
        $onclick = ' onclick="' . $onclick . '"';
      }

      return '<input type="button" class="button" name="' . $this->getName ($name, $index) . '" value="' . $value . '"' . $onclick . '>';
    }

    function getdatedropdowns ($name, $d = 0, $m = 0, $Y = 0, $time = '', $namePattern = 1, $fullTime = false)
    {
      $months = $this->months;
      $htm = array ();
      if ($time)
      {
        $d = date ('d', $time);
        $m = date ('m', $time);
        $Y = date ('Y', $time);
      }

      $htm[] = '<table border="0" cellpadding="0"><tr><td>';
      if ($namePattern === 1)
      {
        $htm[] = '<select name="' . $name . '_d">';
      }
      else
      {
        if ($namePattern === 2)
        {
          $htm[] = '<select name="day_' . $name . '">';
        }
      }

      $htm[] = '<option value="-1">Day';
      for ($i = 1; $i <= 31; ++$i)
      {
        $htm[] = '<option value="' . $i . '"' . ($d == $i ? ' selected' : '') . '>' . $i;
      }

      $htm[] = '</select>';
      $htm[] = '</td><td>';
      if ($namePattern === 1)
      {
        $htm[] = '<select name="' . $name . '_m">';
      }
      else
      {
        if ($namePattern === 2)
        {
          $htm[] = '<select name="month_' . $name . '">';
        }
      }

      $htm[] = '<option value="-1">Month';
      foreach ($months as $kay => $value)
      {
        $htm[] = '<option value="' . $kay . '"' . ($m == $kay ? ' selected' : '') . '>' . $value;
      }

      $htm[] = '</select>';
      $htm[] = '</td><td>';
      if ($namePattern === 1)
      {
        $htm[] = '<select name="' . $name . '_Y">';
      }
      else
      {
        if ($namePattern === 2)
        {
          $htm[] = '<select name="year_' . $name . '">';
        }
      }

      $htm[] = '<option value="-1">Year';
      for ($i = 1970; $i <= 2015; ++$i)
      {
        $htm[] = '<option value="' . $i . '"' . ($Y == $i ? ' selected' : '') . '>' . $i;
      }

      $htm[] = '</select>';
      $htm[] = '</td>';
      if ($fullTime)
      {
        $H = date ('H', $time);
        $htm[] = '<td>&nbsp;';
        if ($namePattern === 1)
        {
          $htm[] = '<select name="' . $name . '_H">';
        }
        else
        {
          if ($namePattern === 2)
          {
            $htm[] = '<select name="hour_' . $name . '">';
          }
        }

        $htm[] = '<option value="-1">Hour';
        for ($i = 1; $i <= 24; ++$i)
        {
          $tmph = ($i < 10 ? '0' . $i : $i);
          $htm[] = '<option value="' . $tmph . '"' . ($H == $tmph ? ' selected' : '') . '>' . $tmph;
        }

        $htm[] = '</select>';
        $htm[] = '</td>';
        $m = date ('i', $time);
        $htm[] = '<td>:';
        if ($namePattern === 1)
        {
          $htm[] = '<select name="' . $name . '_min">';
        }
        else
        {
          if ($namePattern === 2)
          {
            $htm[] = '<select name="minute_' . $name . '">';
          }
        }

        $htm[] = '<option value="-1">Minute';
        for ($i = 1; $i <= 60; ++$i)
        {
          $tmpm = ($i < 10 ? '0' . $i : $i);
          $htm[] = '<option value="' . $tmpm . '"' . ($m == $tmpm ? ' selected' : '') . '>' . $tmpm;
        }

        $htm[] = '</select>';
        $htm[] = '</td>';
      }

      $htm[] = '</tr></table>';
      return implode ('
', $htm);
    }

    function getdate ($name, $date)
    {
      return $this->getDateDropDowns ($name, 0, 0, 0, $date->getGmtTime (), 2);
    }

    function getdatetime ($name, $date)
    {
      return $this->getDateDropDowns ($name, 0, 0, 0, $date->getGmtTime (), 2, true);
    }

    function getname ($name, $index)
    {
      if ($index == -1)
      {
        return $name;
      }

      return $name . '[]';
    }

    function setfieldvalue ($name, $value, $index = -1)
    {
      if ($index == -1)
      {
        $this->fields[$name] = $value;
        return null;
      }

      $this->fields[$name][$index] = $value;
    }

    function getfieldvalue ($name, $index = -1)
    {
      if ($index == -1)
      {
        if (isset ($this->fields[$name]))
        {
          return cowencode ($this->fields[$name]);
        }

        return '';
      }

      if (isset ($this->fields[$name][$index]))
      {
        return cowencode ($this->fields[$name][$index]);
      }

      return '';
    }

    function setfields ($fields)
    {
      if (is_array ($fields))
      {
        foreach ($fields as $name => $value)
        {
          $this->fields[$name] = $value;
        }
      }

    }

    function getfields ()
    {
      return $this->fields;
    }

    function savegeneralsettings ($categoryName)
    {
      if ($row = sql_obj ('SELECT * FROM tblgeneralsettings WHERE category=\'' . $categoryName . '\''))
      {
        $old_settings = unserialize ($row->settings);
        foreach ($this->fields as $key => $value)
        {
          $old_settings[$key] = $value;
        }

        sql_update ('UPDATE tblgeneralsettings SET settings=\'' . serialize ($old_settings) . '\' WHERE category=\'' . $categoryName . '\'');
        return null;
      }

      sql_insert ('INSERT tblgeneralsettings SET category=\'' . $categoryName . '\', settings=\'' . serialize ($this->fields) . '\'');
    }

    function saveproperties ($categoryName, $propertieName = '', $fnc = '', $id = true, $page = '', $templateId = 0)
    {
      $propertyId = 0;
      if ($this->fields['template_id'])
      {
        $propertyId = $this->fields['template_id'];
      }

      $pList = serialize ($this->fields);
      if (!($propertyId))
      {
        $sqlSelect = 'SELECT * FROM tblproperties
                        WHERE category=\'' . $categoryName . '\'
                            AND property_name=\'' . $propertieName . '\'
                                AND templateID=' . $templateId;
      }
      else
      {
        $sqlSelect = 'SELECT * FROM tblproperties
                        WHERE propertyID=\'' . $propertyId . '\'
                                AND templateID=' . $templateId;
      }

      if ($row = sql_obj ($sqlSelect))
      {
        $this->lastTplId = $row->propertyID;
        sql_update ('UPDATE tblproperties SET properties_list=\'' . $pList . '\', templateID=' . $templateId . ' WHERE propertyID=' . $row->propertyID);
        if ($fnc)
        {
          if (preg_match ('/^\\w+\\.\\w+$/', $fnc))
          {
            $fnc = '{' . $fnc . '}';
          }
          else
          {
            if ($id)
            {
              $fnc = '{' . $fnc . '(' . $row->propertyID . ')}';
            }
            else
            {
              $fnc = '{' . $fnc . '()}';
            }
          }

          if ($page)
          {
            runrebuildtemplates ($fnc, $page);
            return null;
          }

          runrebuildtemplates ($fnc);
          return null;
        }

        if ($page)
        {
          runrebuildtemplates ($fnc, $page);
          return null;
        }
      }
      else
      {
        $this->lastTplId = sql_insert ('INSERT tblproperties SET category=\'' . $categoryName . '\', property_name=\'' . $propertieName . '\', properties_list=\'' . $pList . '\', templateID=' . $templateId, 1);
      }

    }

    function getlasttplid ()
    {
      return $this->lastTplId;
    }

    function destroy ()
    {
      unset ($this[fields]);
    }
  }

?>


Then save it.

Upload it to your server to here:
root/cowadmin/lib/

MAKE A BACKUP of the original file.

Then create another file and call it date_component.php

then paste to it this code:

Code:
<?
  function datecomponent ($time = 0)
  {
    $d = 0;
    $m = 0;
    $Y = 0;
    if (0 < $time)
    {
      $d = getdate ('d', $time);
      $m = getdate ('m', $time);
      $Y = getdate ('Y', $time);
    }

    echo '<table border="0" cellpadding="0"><tr><td><select name="d" class="form_objects">
';
    echo '<option value="0">' . _DAY . '
';
    for ($i = 1; $i <= 31; ++$i)
    {
      echo ('<option value="' . $i . '"') . ($d == $i ? ' selected' : '') . ('>' . $i . '
');
    }

    echo '</td><td><select name="m" class="form_objects">
';
    echo '<option value="0">' . _MONTH . '
';
    foreach ($months as $kay => $value)
    {
      echo ('<option value="' . $kay . '"') . ($m == $kay ? ' selected' : '') . ('>' . $value . '
');
    }

    echo '</td><td><select name="Y" class="form_objects">
';
    echo '<option value="0">' . _YEAR . '
';
    for ($i = 1970; $i <= 2015; ++$i)
    {
      echo ('<option value="' . $i . '"') . ($Y == $i ? ' selected' : '') . ('>' . $i . '
');
    }

    echo '</td></tr></table>';
  }

  if (eregi ('date_component.php', $_SERVER['PHP_SELF']))
  {
    header ('Location: ../index.php');
    exit ();
  }

?>


Save it and again upload it to your server:
root/cowadmin/news/date_component.php

Make a backup of the original file.

Presto you got up to 2015 now.

Great job Remalia...

Cool_old

trakmaster Wrote:
Great job Remalia...

Cool_old


Thanks!! I will try to help more out if I can!
This was a judge bug!!?

That's Good You are try to Making the New PHP.So What kind of Updation Your are Making in the PHP Cow.any New feature You will be add or not.How You Design the Website manually or Using the Template.I think Template is the Good for the Future.In the Future If You want to change the look of the Website You can Easily Change it With The Very Few Efforts.
Hi,

1 step

Download the attached file form.class.php and replace it with the one on [cowadmin/lib/]

Make sure you have a backup of the original file before replacing.

You're ready to go...
I had to create the categories and then set the the parent_id of the "subcategory" to the id of the parent category in the database manually. Creating an interface in com_category for this is slightly more involved.

sultan.otaibi Wrote:
Hi,

1 step

Download the attached file form.class.php and replace it with the one on [cowadmin/lib/]

Make sure you have a backup of the original file before replacing.

You're ready to go...


DONT install the above attachment, because it has huge bugs within it.

It will make the articles posts to work, but the rest will fail in cowadmin.

I am uploading the correct file for you to install in

cowadmin/lib

Always make a backup before uploading.

remalia Wrote:

sultan.otaibi Wrote:
Hi,

1 step

Download the attached file form.class.php and replace it with the one on [cowadmin/lib/]

Make sure you have a backup of the original file before replacing.

You're ready to go...


DONT install the above attachment, because it has huge bugs within it.

It will make the articles posts to work, but the rest will fail in cowadmin.

I am uploading the correct file for you to install in

cowadmin/lib

Always make a backup before uploading.


Hi remalia,

Still need to copy the two files (form.class.php and date_component.php) or only the last form.class.php from your last post?

Thanks a lot,

Juan.

Pages: 1 2 3 4
Reference URL's